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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
sunilbeckham
Helper I
Helper I

Percent of grand total showing incorrectly in column chart with small multiples.

Hello! I'm trying to show the percentage calculation in a clustered column chart with small multiples of two. However, I can't seem to get the denominator value right in my visual. My table looks something like this:

Student NumberGenderAttendance
100MaleVery Good
101FemaleVery Good
102FemaleInconsistent
103MalePoor
104MaleGood

 

Currently, I'm plotting this information in a chart with small multiples of Gender column, X axis of Attendance column, and Y axis being a simple COUNTA(Student Number) column that I show as Percent of grand total. Here's the screenshot of how it looks presently:


sunilbeckham_0-1693512843214.png

 

Expected result is that each gender field should have a combined total of 100% across the 4 attendance categories. For example, in this visual it should display something like this:
Female- Very Good = 40%, Good = 30%, Inconsistent = 20%, Poor = 10%
Male- Very Good = 30%, Good = 30%, Inconsistent = 20%, Poor = 20%

Thanks in advance!

2 ACCEPTED SOLUTIONS
v-tangjie-msft
Community Support
Community Support

Hi @sunilbeckham ,

 

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

(1) My test data is the same as yours.

(2) We can create a measure.

Measure = 
var _a=COUNTROWS(FILTER(ALLSELECTED('Table'),'Table'[Gender]=MAX('Table'[Gender])))
var _b=COUNTROWS(FILTER(ALLSELECTED('Table'),'Table'[Gender]=MAX('Table'[Gender]) && 'Table'[Attendance]=MAX('Table'[Attendance])))
return DIVIDE(_b,_a)

(3) Then the result is as follows.

vtangjiemsft_0-1693793610257.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

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

Thank you so much for your response and providing the PBIX file. I tried a similar approach to yours and it worked for me. I ended up writing this measure:

 

DIVIDE(COUNTA(Student Number),
CALCULATE(COUNTA(Student Number), ALLSELECTED(Table), VALUES(Table[Gender]) ))


I appreciate your input and help regarding this. Thank You!

View solution in original post

2 REPLIES 2
v-tangjie-msft
Community Support
Community Support

Hi @sunilbeckham ,

 

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

(1) My test data is the same as yours.

(2) We can create a measure.

Measure = 
var _a=COUNTROWS(FILTER(ALLSELECTED('Table'),'Table'[Gender]=MAX('Table'[Gender])))
var _b=COUNTROWS(FILTER(ALLSELECTED('Table'),'Table'[Gender]=MAX('Table'[Gender]) && 'Table'[Attendance]=MAX('Table'[Attendance])))
return DIVIDE(_b,_a)

(3) Then the result is as follows.

vtangjiemsft_0-1693793610257.png

 

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

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. 

Thank you so much for your response and providing the PBIX file. I tried a similar approach to yours and it worked for me. I ended up writing this measure:

 

DIVIDE(COUNTA(Student Number),
CALCULATE(COUNTA(Student Number), ALLSELECTED(Table), VALUES(Table[Gender]) ))


I appreciate your input and help regarding this. Thank You!

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.