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.
Hi All
I would like to create a measure that will count a value in one column then divides by another.
I have tried to create the measure for Male & Female but it does not bring back the result by splitting by Race.
The measure should count per Race then divide by Staff Count (which I have a measure for).
Basically I would require 2 measures, one for Male & the other for Female which I can use in my table.
I have columns:
Race
Female% (Female % = CALCULATE([Female Count]/[Staff Count])
Male% (Male % = CALCULATE([Male Count]/[Staff Count])
Table currently:
Result desired:
Solved! Go to Solution.
Hi @rush,
Yes you can put the filter while summarizing the table. Use below syntax:
Race %Age = CALCULATETABLE(SUMMARIZE(Staff,Staff[Race],"TotalStaff",SUM(Staff[Staff Count]),"Male",CALCULATE(SUM(Staff[Staff Count]),FILTER(Staff,Staff[Gender]="Male")),"Female",CALCULATE(SUM(Staff[Staff Count]),FILTER(Staff,Staff[Gender]="Female"))),FILTER(Staff,Staff[Team Member Status]="Active")
I hope this will work for you to get the desired result. If it works please accept it as a solution.
Thanks & Cheers!!!
Anupam
Hi,
First you need to create the MaleCount_PerRace (Staff Count * Male%) & FemaleCount_PerRace (Staff Count * Female%). After that you create:
Race_Male = MaleCount_PerRace / sum(Staff Count)
Race_Female = FemaleCount_PerRace / sum(Staff Count)
Hope this is what you want.
Thanks,
Anupam
Thank you very much.
I created those as mesaures but it does not bring back the results I require.
Hi @rush,
Could share the sample data from your raw data please? Or you can create the calculated column instead of measure and check whether you are getting the desired result or not.
Thanks,
Anupam
It is bringing back 100% for all the males.
Thanks.
Please see raw data below in link:
@anupampandey Thank you very much.
The summarized table helped a lot but I forgot to mention is it possible to add a filter for that entire table to only include Active Team Members?
I have a column called Team Member Status which can be used to filter the summarized table to only bring back Active Team Members.
Hi @rush,
Yes you can put the filter while summarizing the table. Use below syntax:
Race %Age = CALCULATETABLE(SUMMARIZE(Staff,Staff[Race],"TotalStaff",SUM(Staff[Staff Count]),"Male",CALCULATE(SUM(Staff[Staff Count]),FILTER(Staff,Staff[Gender]="Male")),"Female",CALCULATE(SUM(Staff[Staff Count]),FILTER(Staff,Staff[Gender]="Female"))),FILTER(Staff,Staff[Team Member Status]="Active")
I hope this will work for you to get the desired result. If it works please accept it as a solution.
Thanks & Cheers!!!
Anupam
Thank you.
I managed to add the filters but to each column needed.
Will use your formula as well.
Staff EE = SUMMARIZE(Staff,Staff[Race Group],
"TotalStaff",CALCULATE(SUM(Staff[Staff Count]),Staff[Team Member Status] = "Team Member"),
"Male",CALCULATE(SUM(Staff[Staff Count]),FILTER(Staff,Staff[Gender]="Male"),Staff[Team Member Status] = "Team Member"),
"Female",CALCULATE(SUM(Staff[Staff Count]),FILTER(Staff,Staff[Gender]="Female"),Staff[Team Member Status] = "Team Member"))
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
82 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |