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.
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.
Is there a way to adjust the "Difference" formula above to calculate across rows when the value is blank? This formula works for what I need, but I have blanks in my subtotals and it does not work in those situations. Your help would be greatly appreciated!
I'm expecting 1 - (blank) = 1 (Target Remaining) and (blank) - 1 = -1 (Target Remaining).