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
JohannB
Helper I
Helper I

Calculation of multiple subtotal %

Hi,

I am trying to show each % column to add up to 100%

Example:

Capture.JPG

 Thank you in advance

1 ACCEPTED SOLUTION

Hi @JohannB,

 

You are adding the values as a column, you need to do the exact same calculation but as a measure not a column as you can see below using the same formula on a column gives the 29% (this is making a row context and then adding it up) making it on a measure it will take into account the table context and give the correct results.

 

Please refer to this link to have additional information also look in Google "Calculated Columns vs Measures in PBI".

 

MEASURES_vs_COLUMNS_1.png

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

5 REPLIES 5
v-shex-msft
Community Support
Community Support

Hi @JohannB,

 

Can you share some sample data to test?
In addition, if you want to modify the total row calculation, you can add some conditions to filter on it.

 

For example:

7.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Thank you MFelix this resolves the issue. JohannB

MFelix
Super User
Super User

Hi @JohannB,

 

How are you calculating the % for each columns? It seems to me you are having a column with the % and the adding it to your visual is this it?

 

When you want to calculate over your context you need to use measures if you use the columns to make the %, averages whatever then when you add them to your visuals the context is at a row level and you will get the sum not the correct value.

 

You need to have a measure in order to calculate the % over the subtotals. something like this:

% Collection Obtained Measure =
IFERROR (
    SUM ( Payments[Collected to date] ) / SUM ( Payments[Personal Target] ),
    0
)

FInal result will be this:

 

MEASURES_vs_COLUMNS.png

 

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



I have tried the formula suggested but the result displayes a constant 29 % on all tyhe rows. The suntotals still rtemain a sum instead of a calculation. The equation used is: 

% Collection Obtained = IFERROR(SUM('Table 2'[Collected to date])/SUM('Table 2'[Personal Target]).0)

What I am looking for is what I had in Excel as displayed below.

Untitled.jpg

 

 

Hi @JohannB,

 

You are adding the values as a column, you need to do the exact same calculation but as a measure not a column as you can see below using the same formula on a column gives the 29% (this is making a row context and then adding it up) making it on a measure it will take into account the table context and give the correct results.

 

Please refer to this link to have additional information also look in Google "Calculated Columns vs Measures in PBI".

 

MEASURES_vs_COLUMNS_1.png

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.