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
You need to put Zone in the rows, Year in the column, and Amount, Difference and %Inc as values.
Raul
9 years agoPost Patron
Hello dkay84_PowerBI!
I have one problem with shrink the columns in a matrix visualization. I create this visualization:
When I show the matrix like this, shrink the columns with values to 0:
and I refresh the data, the shrink columns are displayed again.
Is there any solution to avoid this?
Thank you.
- Anonymous7 years agoNot applicable
Hi did you fix this issue?