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
yfquirogah
Helper I
Helper I

Porcetange by month

Hello guys!

 

I'm trying to show a percentage but I haven't find the right way yet. I currently have this data:

 

Captura.JPG

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.

 

 

1 ACCEPTED SOLUTION

@yfquirogah 

 

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)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Is "Total" a measure?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

This is a basic example of the data base I'm using:

 

YearMonthEmployee IDGender
2020January161Male
2020January143Male
2020January181Female
2020January198Male
2020January136Female
2020January150Male
2020January104Female
2020February161Male
2020February143Male
2020February181Female
2020February198Male
2020February136Female
2020February150Male
2020February104Female
2020February188Female
2020March161Male
2020March143Male
2020March181Female
2020March198Male
2020March136Female
2020March104Female
2020March188Female

 

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:

 

YearMonthTotal MaleFemale
2020January743
2020February844
2020March735

 

What I want is to get the % of female and male employees I have each month, something like this:

 

YearMonthTotal MaleFemale%Male%Female
2020January74357%43%
2020February84450%50%
2020March73543%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!

 

@yfquirogah 

 

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)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amitchandak
Super User
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]))
ryan_mayu
Super User
Super User

@yfquirogah 

 

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.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.