Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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 Number | Gender | Attendance |
| 100 | Male | Very Good |
| 101 | Female | Very Good |
| 102 | Female | Inconsistent |
| 103 | Male | Poor |
| 104 | Male | Good |
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:
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!
Solved! Go to Solution.
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.
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!
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.
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!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 14 | |
| 10 | |
| 5 | |
| 5 |