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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

How to calculate below simple % in matrix chart

Hi all, 

I am using a matrix chart , where I want to show the % of each category  like below :

 

skondi_0-1599731885239.png

for MUID 500167, there are 3-categories and frequency of each is mentioned.  here Category 'General Medicine' have F=2, so % is 2/4*100 ie 50%, later for 'Infection Diease' F =1 , so % =1/4*100 ie 25% ,so on.

 

can someone help me?

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

Hi @Anonymous ,

 

Create a measure as below:

Measure = 
var _counttotal=CALCULATE(SUM('Table'[M_Frequency]),FILTER(ALL('Table'),'Table'[MUID]=MAX('Table'[MUID])))
Return
IF(ISINSCOPE('Table'[Category]),DIVIDE(MAX('Table'[M_Frequency]),_counttotal),BLANK())

And you will see:

Annotation 2020-09-14 104945.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

View solution in original post

4 REPLIES 4
v-kelly-msft
Community Support
Community Support

Hi @Anonymous ,

 

Create a measure as below:

Measure = 
var _counttotal=CALCULATE(SUM('Table'[M_Frequency]),FILTER(ALL('Table'),'Table'[MUID]=MAX('Table'[MUID])))
Return
IF(ISINSCOPE('Table'[Category]),DIVIDE(MAX('Table'[M_Frequency]),_counttotal),BLANK())

And you will see:

Annotation 2020-09-14 104945.png

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
amitchandak
Super User
Super User

@Anonymous , This seem like % of the subtotal

You need to use all except

 

Assume you are using Cat under MUID (rows of matrix)

Try a new measure like

% of subtotal = divide([M_frequency], calculate([M_frequency] , allexcept(Table, Table[Cat])))

 

refer :https://community.powerbi.com/t5/Desktop/Percentage-of-subtotal/td-p/95390

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
PaulDBrown
Community Champion
Community Champion

@Anonymous 

can you share a sample dataset or even better a PBIX file?

 

by the looks of it, you need an inital measure which would be:

frequency of selected categories =
CALCULATE( [Sum of Frequencies], ALLSELECTED (Table[Category]))

 

followed by the final measure::

% of selected categories = DIVIDE( [Sum of Frequencies], [frequency of selected categories])





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown - Tested your solution Paul, worked like a charm.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.