Forum Discussion
AmandaLu
4 years agoFrequent Visitor
Calculate the difference between two columns in a matrix when each row is a measure
Hi, I'm working on a matrix in Power BI that compares this fiscal years' sales, transactions, units, customerscount to last year's. Each row is it's own calculated measure. Is there any ...
- 4 years ago
Hi AmandaLu
Yes that can be done utilizing the column subtotal. For exampleMeasure2 = VAR CurrentValue = [Measure1] VAR MaxYear = MAX ( 'Date'[Year] ) VAR MinYear = MIN ( 'Date'[Year] ) VAR MaxYearValue = CALCULATE ( [Measure1], 'Date'[Year] = MaxYear ) VAR MinYearValue = CALCULATE ( [Measure1], 'Date'[Year] = MinYear ) RETURN IF ( HASONEVALUE ( 'Date'[Year] ), CurrentValue, MaxYearValue - MinYearValue )And you can manually change the name from "Total" to "Difference"