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
Thedatadude
Frequent Visitor

Get percent of total by count of value by Customer

Hello All, 

 

I am trying to calculate via Measure on a dashboard the % of 3 values in a column for each of my customers in our gender column. F is female, M is male, and I is undisclosed. This is what I have tried thus far... the dashboard does filter on multiple customers. So in the below we may have Google1, Google 2 so the multiple selection is needed. If all google accounts are selected via slicer Male would be 75% for just Google2 it would be 50%. etc. 

GENDER2 =
COUNT(Query1[Gender]) / CALCULATE(COUNT(Query1[Gender]) , FILTER('Query1',)))
Customer

Gender

 

Google 1M
Google 1M
Google 2 F
Google 2 M
MicrosoftI
MicrosoftI
1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Thedatadude , 

You could try below measure

Measure = CALCULATE(COUNT('Table'[Gender]))/CALCULATE(COUNT('Table'[Gender]), ALLSELECTED('Table'))

795.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
dax
Community Support
Community Support

Hi @Thedatadude , 

You could try below measure

Measure = CALCULATE(COUNT('Table'[Gender]))/CALCULATE(COUNT('Table'[Gender]), ALLSELECTED('Table'))

795.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

so close 🙂 just thought of allselected this morning, but you beat me to it.

not sure if this is what you're looking for, but:

% by Gender = 

var result = DIVIDE (

[GenderCount],

CALCULATE (

[GenderCount],

ALL (

'Table'[Gender]

)

)

)

return result

 

with another measure that is:

GenderCount = COUNT('Table'[Gender])

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.