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
Jonas_Bertels
New Member

Calculating a % on a row subtotal based on a calculated column

Hi,

I have the created a calculated column which takes a profitability % as follows: (Revenues-costs)/Costs-1, as percentage.

This goes without any issues in the data table, but when I try to visualize this in a matrix, I get the following issue:

Cost                         Revenue          Profitability

Jonas_Bertels_0-1599055295624.png

The individual % are correctly calculated. What I would like to have, is that the subtotal, the line in bold, is taking the same formula and calculating it on the sums of the costs and revenues of the individual parts.

 

Could anyone help me out on how to correctly use PowerBI for this?

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

Hi @Jonas_Bertels ,

 

When you put the calculated column into the matrix, the subtotal is the sum of your calculated column.

534.92%+121.30%+(-100%)=556.22%.

It is suggested to try this measure instead of the calculated column.

Profitability =
DIVIDE (
    SUM ( 'Table'[Revenue] ) - SUM ( 'Table'[Cost] ),
    SUM ( 'Table'[Cost] )
)

6.png

 

You can check more details from here.

 

 

Best Regards,

Stephen Tao

 

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

5 REPLIES 5
v-stephen-msft
Community Support
Community Support

Hi @Jonas_Bertels ,

 

When you put the calculated column into the matrix, the subtotal is the sum of your calculated column.

534.92%+121.30%+(-100%)=556.22%.

It is suggested to try this measure instead of the calculated column.

Profitability =
DIVIDE (
    SUM ( 'Table'[Revenue] ) - SUM ( 'Table'[Cost] ),
    SUM ( 'Table'[Cost] )
)

6.png

 

You can check more details from here.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This is exactly what I needed, Thank you Stephen!

ryan_mayu
Super User
Super User

@Jonas_Bertels 

you can try

percentage = 

if(ISFILTERED('Table'[type]),[revenue_cost]/[_cost]-1,SUMX('Table',[revenue_cost]/'Table'[cost]-1))

1.PNG





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

Proud to be a Super User!




amitchandak
Super User
Super User

@Jonas_Bertels , if they are columns try like

divide(Sum(Table[Revenues-costs]) -Sum(Table[Costs]) , Sum(Table[Costs]))

if measure try like
divide((Table[Revenues-costs]) -(Table[Costs]) , (Table[Costs]))

 

Also refer :https://www.youtube.com/watch?v=ufHOOLdi_jk

Greg_Deckler
Super User
Super User

@Jonas_Bertels This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.