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
RK_JOB
Helper II
Helper II

% male and female in card DAX

Hi,

 

I am trying to find the % of male and Female from the total headcount. This is a formula for Male. I created same formula for female.

RK_JOB_0-1632883306910.png

 

and I get correct value.

 

 

RK_JOB_2-1632883407234.png

 

The problem happens if I click on "female" somewhere on the page then due to formula, it still keeps 8,489 for male in internal memory as I think Filter in the formula takes precedence and divides 8,489/12,680 and gives me 67% which is clearly wrong. How do I create DAX properly in this situation?

 

The number card comes correct because I put a filter in filter pan as "male" for gender.

 

RK_JOB_3-1632883520893.png

 

Thanks in advance,

RK

 

 

 

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Try this measure

Male headcount = calculate([headcount],filter(values(HC[Gender_text]),HC[Gender_text]="Male"))

% male = divide([Male headcount],[headcount])

Hope this helps.


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

View solution in original post

1 REPLY 1
Ashish_Mathur
Super User
Super User

Hi,

Try this measure

Male headcount = calculate([headcount],filter(values(HC[Gender_text]),HC[Gender_text]="Male"))

% male = divide([Male headcount],[headcount])

Hope this helps.


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

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.