Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
nachobarr2020
Regular Visitor

Dax measure percentage for a group

 

Hello dear community,

 

I hope you are ok. I need your assistance with the following. I have a bar chart that shows the ammount of people by gender and group age as shown in the image. The total ammount of people is 511 and for instance for the age group 45-49 the amount of females is 59, this is correct, this I do it by putting into the bar chart the variable GID (which is my id) and then display the count of them. However when I want to see the result as a percentage the results are not correct. Instead of showing for the given case 59/511= 11% it shows 6%. I would need maybe a measure in dax so that when I put in the x axis the age group and in the y axis the measure the % over the total is correctly displayed by gender (so in this case for instance 11% female and 9% male for the age group 45-49)

 

 

image power bi.png

image 4.png

 

Thank you in advance!!!

1 ACCEPTED SOLUTION
v-tangjie-msft
Community Support
Community Support

Hi @nachobarr2020 ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1699841375520.png

(2) We can create a measure. 

Measure = 
var _a= COUNT('Table'[gid])
var _b=CALCULATE(COUNT('Table'[gid]),ALL('Table'))
return DIVIDE(_a,_b,0)

(3) Then the result is as follows.

vtangjiemsft_1-1699841547472.png

Best Regards,

Neeko Tang

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

1 REPLY 1
v-tangjie-msft
Community Support
Community Support

Hi @nachobarr2020 ,

 

According to your description, here are my steps you can follow as a solution.

(1) This is my test data. 

vtangjiemsft_0-1699841375520.png

(2) We can create a measure. 

Measure = 
var _a= COUNT('Table'[gid])
var _b=CALCULATE(COUNT('Table'[gid]),ALL('Table'))
return DIVIDE(_a,_b,0)

(3) Then the result is as follows.

vtangjiemsft_1-1699841547472.png

Best Regards,

Neeko Tang

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

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.