Forum Discussion
Difference between two columns or rows
- 9 years ago
Create a measure called "Difference"
Difference = IF ( HASONEVALUE ( 'Table'[YEAR] ), BLANK (), CALCULATE ( SUM ( 'Table'[AMOUNT] ), FILTER ( 'Table', 'Table'[YEAR] = MAX ( 'Table'[YEAR] ) ) ) - CALCULATE ( SUM ( 'Table'[AMOUNT] ), FILTER ( 'Table', 'Table'[YEAR] = MIN ( 'Table'[YEAR] ) ) ) )Then a measure called "%Inc"
%Inc = DIVIDE ( [Difference], CALCULATE ( SUM ( 'Table'[AMOUNT] ), FILTER ( 'Table', 'Table'[YEAR] = MIN ( 'Table'[YEAR] ) ) ) )Then just shrink the columns in your matrix that have no data so they don't show up, and make sure to turn the row totals on:
Oh and change the formatting/style for the measures as desired.
Hi. I would calcolate the difference between the import of 2017 vs 2016. I have inserted a column with a new measure in this way:
Difference = IF (HASONEVALUE ('CdeAuftragK'[Anno]);BLANK (); CALCULATE (SUM ( 'CdeAuftragK'[ValoreVendita] ); FILTER ( 'CdeAuftragK'; 'CdeAuftragK'[Anno] = MAX ( 'CdeAuftragK'[Anno] ) ))- CALCULATE (SUM ( 'CdeAuftragK'[ValoreVendita]);FILTER ( 'CdeAuftragK';'CdeAuftragK'[Anno] = MIN ( 'CdeAuftragK'[Anno] ) )))
as I see in the reply. The value in the column is wrong but I think is my interpretation of command. It likes on lines instead of columns. How Can I resolve? Thank you.