Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
This has been hard to figure out. I think I am close but something is missing.
In excel this is super easy to do. (Example below). But Power Bi is a different story.
In Power BI I have these columns and the department count is counting how many are within each department. It looks something like this:
Employee Name Department name Department Count:
John Administration 2
Frank Administration 2
Jane IT 1
Sam Development 2
Shane Development 2
To get the Department count I used the Allexcept function.
What I want to do is now take those numbers, total them and then get the percentage. The problem is when I total them its totaling all the numbers. I want to just total them by departmeent. So the total should be 5. From there, I need to take the the total of one department and divide it by the total of all the departments to get a percentage, for each department.
For example,
Administration - 2/5 = 40%
IT = 1/5 = 20%
Development 2/5=40%
Total = 100%
Thanks!
Solved! Go to Solution.
Hi @Anonymous ,
Create a measure as below:
Measure =
var _tab=SUMMARIZE('Table','Table'[Department name],"percent",DIVIDE(CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Department name])),CALCULATE(COUNTROWS('Table'),ALL('Table'))))
Return
SUMX(_tab,[percent])
And you will see:
For the related .pbxi file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Hi @Anonymous ,
Create a measure as below:
Measure =
var _tab=SUMMARIZE('Table','Table'[Department name],"percent",DIVIDE(CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Department name])),CALCULATE(COUNTROWS('Table'),ALL('Table'))))
Return
SUMX(_tab,[percent])
And you will see:
For the related .pbxi file,pls see attached.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
@Anonymous
Try the following formula for denominator:
CALCULATE(DISTINCTCOUNT('Table'[Employee Name]), ALL('Table'))
User | Count |
---|---|
125 | |
108 | |
99 | |
63 | |
62 |
User | Count |
---|---|
135 | |
116 | |
101 | |
71 | |
61 |