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
Anonymous
Not applicable

calculating percentage at all levels in Power Bi in Matrix

Hi,

 

I'm trying to create a column that calculates percentage from top level till the least level in a matrix.

 

Here is the sample of my data set. the column here is the calculated column for percentage.

 

1.PNG                                                                                                                                                                                                                                                                                          

I'm creating a matrix like this. Column 1, 2, 3 in rows and Value1, 2 and calculated column in values. I have selected to average the percentage calculated column.

 

2.PNG

 

At the least level the calculation of percentage is correct. For Example, In the calculation for F3 for 01 May 2018 (10/12)*100 = 83.33. This is correct.

 

But at F3 level (33/144) * 100 = 22.91 is the correct one. But here it averages the 3 values beneath it. I know that is because I have chosen to average it. But I want this percentage to be calculated at all levels correctly. Also the total should be calculating the same thing.

 

Kindly assist.

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

maybe you should use a measure instead of a calculated column like this:

SUM('Table1'[Value2]) / SUM('Table1[Value1]) * 100

 

I think this is what you are looking for. The measure creates the sums first and then performs the division.

 

Wondering if this is what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
TomMartens
Super User
Super User

Hey,

 

maybe you should use a measure instead of a calculated column like this:

SUM('Table1'[Value2]) / SUM('Table1[Value1]) * 100

 

I think this is what you are looking for. The measure creates the sums first and then performs the division.

 

Wondering if this is what you are looking for.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

Perfect ! Is there a way to show this as %. If it is a column I can do it from formatting in Modelling tab. Is there a way to do the same for a measure ?

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.