Forum Discussion
dasari2020
6 years agoFrequent Visitor
Compute difference between Subtotals
Hi , Can some one guide me on how to calculate the difference between two subtotals in DAX?
- 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])