Forum Discussion
Compute difference between Subtotals
- 6 years ago
Right, again, no sample data so can't be specific. Hint.
But, in general, you want to do this. Take a look at your visual and see how it is aggregated. Let's say it is by "Thing". You want to create a virtual table using a VAR that emulates this and your columns. Then use SUMX and basic math. Something like this:
Subtotal Difference = VAR __Table = SUMMARIZE( 'Table', [Thing], "2019",SUM([2019), "2020",SUM([2020) ) RETURN SUMX(__Table,[2019]) - SUMX(__Table,[2020])
Are those measures or column aggregations? Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
This *might* help if it is measures. 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
- dasari20206 years agoFrequent Visitor
These are column aggregations. I want to calculate the differenence between these 2 subtotals. How can i add a measure to calculate this?
- Greg_Deckler6 years agoCommunity Champion
Right, again, no sample data so can't be specific. Hint.
But, in general, you want to do this. Take a look at your visual and see how it is aggregated. Let's say it is by "Thing". You want to create a virtual table using a VAR that emulates this and your columns. Then use SUMX and basic math. Something like this:
Subtotal Difference = VAR __Table = SUMMARIZE( 'Table', [Thing], "2019",SUM([2019), "2020",SUM([2020) ) RETURN SUMX(__Table,[2019]) - SUMX(__Table,[2020])