Forum Discussion
Raul
9 years agoPost Patron
Difference between two columns or rows
Hello everybody, I need to find the difference between two columns or two rows within a table or matrix of values. I have the following situation: YEAR ZONE EAST W...
- 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.
dkay84_PowerBI
9 years agoMicrosoft Employee
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.
Raul
9 years agoPost Patron
Perfect, this is the answer: I have to shrink the columns in mymatrix that have no data.
But the first visualization is not posible to do the same. Any suggestion?