Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AMBP1973
Helper III
Helper III

Calculate selected values in a column to show percentage differences

Hello, I have 3 columns that all indictae certain positions against a task, each position may assume 1 or all roles for that task, some roles also being 'unassigned' (Content Author, Content Manager, Approver). I have already aggregated these into a single column 

Content Manage. Roles Aggr = 'DI Review'[Content Author] & "-" & 'DI Review'[Content Manager] & "-" & 'DI Review'[Approver]
 
I am now trying to acheive the following:
1. Create a pie visual that shows % of assigned vs unassigned. For example total number of positions (i.e position titles) vs total number of 'unassigned'
2. Create a slicer that allows selection of a single position, as currently, due the position values being repeated across 3 columns it is showing multiple values in each slection.
 
Unfortuantely I cannot share that data (please refer to screen shots for context). I would appreciate any assistance. Please also note that I cannot open the latest PBIX files, so dax and instructions would be much appreciated.

 

AMBP1973_0-1762824066929.png

AMBP1973_1-1762824602509.png

 

 

 

2 ACCEPTED SOLUTIONS
Zanqueta
Resolver II
Resolver II

Hi @AMBP1973.

 

Lets my suggestions for goal 1:

 

First Step: Create a calculated table that unpivots the 3 columns into a single column of positions

PositionsExpanded = 
UNION(
    SELECTCOLUMNS(Task, "Position", Task[Content Author]),
    SELECTCOLUMNS(Task, "Position", Task[Content Manager]),
    SELECTCOLUMNS(Task, "Position", Task[Aprover])
)

Then, create a calculated column to classify each row:

RoleStatus =
IF(
    PositionsExpanded[Position] = "unassigned",
    "Unassigned",
    "Assigned"
)

 

zanqueta001_1-1762875369643.png

Now, create a measure to count and calculate percentages:

COUNTROWS(PositionsExpanded)

include RoleStatus in Legend:

zanqueta001_2-1762875528934.png

 

 

 

 

 

View solution in original post

Hi @AMBP1973 ,

with pleasure.

 

Assuming that this is the structure of your origin or source table:

DNMAF_0-1762931190098.png

and assuming that you have this table already loaded into Power Query,

 

you have to perform the following steps to transform the table to the format I suggested:

  1. Create a duplicate or reference of the origin table
  2. Unpivot the three role columns
  3. Do some renaming
  4. Create an index column
  5. Reorder the columns if you want to

You can add these steps without any coding using the UI or copy the following Power Query (M) Code:

 

let
  Source = OriginTable,
  #"Unpivoted Only Selected Columns" = Table.Unpivot(Source, {"Content Author", "Content  Manager", "Approver"}, "Attribute", "Value"),
  #"Renamed Columns" = Table.RenameColumns(#"Unpivoted Only Selected Columns",{{"Attribute", "Role"}, {"Value", "Assigned"}}),
  #"Added Index" = Table.AddIndexColumn(#"Renamed Columns", "Index", 1, 1, Int64.Type),
  #"Reordered Columns" = Table.ReorderColumns(#"Added Index",{"Index", "Task", "Role", "Assigned"})
in
  #"Reordered Columns"

 

Hope that helps and works for you.

 

 

View solution in original post

6 REPLIES 6
Zanqueta
Resolver II
Resolver II

Hi @AMBP1973.

 

Lets my suggestions for goal 1:

 

First Step: Create a calculated table that unpivots the 3 columns into a single column of positions

PositionsExpanded = 
UNION(
    SELECTCOLUMNS(Task, "Position", Task[Content Author]),
    SELECTCOLUMNS(Task, "Position", Task[Content Manager]),
    SELECTCOLUMNS(Task, "Position", Task[Aprover])
)

Then, create a calculated column to classify each row:

RoleStatus =
IF(
    PositionsExpanded[Position] = "unassigned",
    "Unassigned",
    "Assigned"
)

 

zanqueta001_1-1762875369643.png

Now, create a measure to count and calculate percentages:

COUNTROWS(PositionsExpanded)

include RoleStatus in Legend:

zanqueta001_2-1762875528934.png

 

 

 

 

 

Thankyou @Zanqueta , THis provided a parcial solution

DNMAF
Advocate II
Advocate II

Hi @AMBP1973 ,

independently of what you wanna do with the data I would recommend to change the structure of your table to something like this:

 

Assignement IDTaskRoleAssigned
1Task 1Content AuthorUnassigned
2Task 1Content ManagerUnassigned
3Task 1ApproverUnassigned
4Task 2Content AuthorUnassigned
5Task 2Content ManagerUnassigned
6Task 2ApproverUnassigned
7Task 3Content AuthorTechnical Logistics Officer
8Task 3Content ManagerTechnical Logistics Officer
9Task 3ApproverDeputy Director Supportability Analysis
10Task 4Content AuthorTechnical Logistics Officer
11Task 4Content ManagerTechnical Logistics Officer
12Task 4ApproverDeputy Director Supportability Analysis

You should do that restructuring with Power Query. 

Based on this structure calculations and slicing should be much easier.

 

Does that help you? Do you need any further assistance?

Hello @DNMAF , I am unsure how to go about changing the structure of the table, could you please assist?

@DNMAF 

 

Could you please provide additional guidance on restructuring to acheive the below. Many thanks

 

 

Assignement IDTaskRoleAssigned
1Task 1Content AuthorUnassigned
2Task 1Content ManagerUnassigned
3Task 1ApproverUnassigned
4Task 2Content AuthorUnassigned
5Task 2Content ManagerUnassigned
6Task 2ApproverUnassigned
7Task 3Content AuthorTechnical Logistics Officer
8Task 3Content ManagerTechnical Logistics Officer
9Task 3ApproverDeputy Director Supportability Analysis
10Task 4Content AuthorTechnical Logistics Officer
11Task 4Content ManagerTechnical Logistics Officer
12Task 4ApproverDeputy Director Supportability Analysis

 

Hi @AMBP1973 ,

with pleasure.

 

Assuming that this is the structure of your origin or source table:

DNMAF_0-1762931190098.png

and assuming that you have this table already loaded into Power Query,

 

you have to perform the following steps to transform the table to the format I suggested:

  1. Create a duplicate or reference of the origin table
  2. Unpivot the three role columns
  3. Do some renaming
  4. Create an index column
  5. Reorder the columns if you want to

You can add these steps without any coding using the UI or copy the following Power Query (M) Code:

 

let
  Source = OriginTable,
  #"Unpivoted Only Selected Columns" = Table.Unpivot(Source, {"Content Author", "Content  Manager", "Approver"}, "Attribute", "Value"),
  #"Renamed Columns" = Table.RenameColumns(#"Unpivoted Only Selected Columns",{{"Attribute", "Role"}, {"Value", "Assigned"}}),
  #"Added Index" = Table.AddIndexColumn(#"Renamed Columns", "Index", 1, 1, Int64.Type),
  #"Reordered Columns" = Table.ReorderColumns(#"Added Index",{"Index", "Task", "Role", "Assigned"})
in
  #"Reordered Columns"

 

Hope that helps and works for you.

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.