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.
Hello guys!
I'm trying to show a percentage but I haven't find the right way yet. I currently have this data:
I have a Total and created two measures to find how many Males and how many Females I we have within that Total. I'm trying to calculate this numbers with a porcentage, so, for example for January 2019 Female porcentage would be 36% and Male porcentage 51% (the remaining is clasified as unknown). So far I haven't been able to get it rigth, it only gives me a porcentage out of the Grand total (4120).
I appreciate any help you can provide.
Solved! Go to Solution.
please try measures below
male = CALCULATE(COUNTROWS(employee),FILTER(employee,employee[Gender]="Male"))
female = CALCULATE(COUNTROWS(employee),FILTER(employee,employee[Gender]="Female"))
male% = [male]/COUNTROWS(employee)
female% = [female]/COUNTROWS(employee)
Proud to be a Super User!
Hi,
Is "Total" a measure?
This is a basic example of the data base I'm using:
Year | Month | Employee ID | Gender |
2020 | January | 161 | Male |
2020 | January | 143 | Male |
2020 | January | 181 | Female |
2020 | January | 198 | Male |
2020 | January | 136 | Female |
2020 | January | 150 | Male |
2020 | January | 104 | Female |
2020 | February | 161 | Male |
2020 | February | 143 | Male |
2020 | February | 181 | Female |
2020 | February | 198 | Male |
2020 | February | 136 | Female |
2020 | February | 150 | Male |
2020 | February | 104 | Female |
2020 | February | 188 | Female |
2020 | March | 161 | Male |
2020 | March | 143 | Male |
2020 | March | 181 | Female |
2020 | March | 198 | Male |
2020 | March | 136 | Female |
2020 | March | 104 | Female |
2020 | March | 188 | Female |
So, I have the Total Measure that gives me the amount of people I have and then if a put it on a graphic shows me the amount on each month, I have a Female measure that counts the total amount of females I have, and I have a Male masure that counts the amount of males I have.
In this database example I basically have this info:
Year | Month | Total | Male | Female |
2020 | January | 7 | 4 | 3 |
2020 | February | 8 | 4 | 4 |
2020 | March | 7 | 3 | 5 |
What I want is to get the % of female and male employees I have each month, something like this:
Year | Month | Total | Male | Female | %Male | %Female |
2020 | January | 7 | 4 | 3 | 57% | 43% |
2020 | February | 8 | 4 | 4 | 50% | 50% |
2020 | March | 7 | 3 | 5 | 43% | 71% |
That way I can create a line chart that shows me each month a line with the % of female employees and the % of male employees.
So far the problem I'm facing is that when I try to get the % of female/male, I get the % over the total amount, not each month, I need each month adds up to 100%.
Thank you for your help!
please try measures below
male = CALCULATE(COUNTROWS(employee),FILTER(employee,employee[Gender]="Male"))
female = CALCULATE(COUNTROWS(employee),FILTER(employee,employee[Gender]="Female"))
male% = [male]/COUNTROWS(employee)
female% = [female]/COUNTROWS(employee)
Proud to be a Super User!
@yfquirogah , if they are columns
male % = divide(sum(table[male]),sum(table[Total]))
female % = divide(sum(table[female]),sum(table[Total]))
remaining % = divide(sum(table[Total]) - sum(table[male]) -sum(table[female]) ,sum(table[Total]))
If they are measures
male % = divide(([male]),([Total]))
female % = divide(([female]),([Total]))
remaining % = divide(([Total]) - ([male]) -([female]) ,([Total]))
Have you caculated the total male & femail?
total=calculate(countrows()), filter(table, gender<>"unknown")
male/total
female/total
It will be better if you share the sample data.
Proud to be a Super User!
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 |
---|---|
110 | |
94 | |
81 | |
66 | |
58 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |