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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mhbon
Frequent Visitor

Dax for total percentage of type

Hi everyone

 

My company wants me to create a table that tracks wich percentage of time is spend doing specific tasks as a percentage of all the work done. It has to look something like this:

 

DepartmentTaskTask2Employee01-202102-2021
AccountingCount moneyCount billsScrooge McDuck25%...
AccountingCount moneyCount changeScrooge McDuck25%...
AccountingPull a prankPrank the nephewsScrooge McDuck25%...
MischiefPull a prankPrank Uncle ScroogeHuey Duck100%...
MischiefPull a prankPrank Uncle ScroogeDewey Duck25%...
MischiefPull a prankPrank Uncle ScroogeLouie Duck50%...

 

The data is formatted in the following way:

 

DepartmentTaskTask2EmployeeDateHours
AccountingCount moneyCount billsScrooge McDuck2021-01-223
AccountingCount moneyCount changeScrooge McDuck2021-01-223
AccountingGo on an adventureFinding treasureScrooge McDuck2021-01-233
MischiefPull a prankPrank Uncle ScroogeHuey Duck2021-01-223
MischiefSleepingGood night sleepDewey Duck2021-01-229
MischiefPull a prankPrank Uncle ScroogeDewey Duck2021-01-223
MischiefPull a prankPrank Uncle ScroogeLouie Duck2021-01-226
AccountingPull a prankPrank the nephewsScrooge McDuck2021-01-223
MischiefPlayPlay with toysLouie Duck2021-01-216

 

When the matrix is collapsed, the results shoud still add up:

 

Department01-202102-2021
Accounting75%...
Mischief44%...

 

I have the matrix containing Department, Task 1 & 2 and employee in the rows and date in the colums. I just can't seem to get to the right measure. Could you help me out?

 

Thanks everyone! 

1 ACCEPTED SOLUTION
rfigtree
Resolver III
Resolver III

mHours:=SUM(Table1[Hours])

mTotalHours:=CALCULATE([mHours],ALLEXCEPT(Table1,Table1[Date]))

m%:=DIVIDE([mHours],[mTotalHours])

 

use m% in your pivot table.

Capture.JPG

View solution in original post

2 REPLIES 2
rfigtree
Resolver III
Resolver III

mHours:=SUM(Table1[Hours])

mTotalHours:=CALCULATE([mHours],ALLEXCEPT(Table1,Table1[Date]))

m%:=DIVIDE([mHours],[mTotalHours])

 

use m% in your pivot table.

Capture.JPG

Anonymous
Not applicable

Hello @mhbon 
After transformation I can't see the percentage values. Is data is missing in the above table?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors