Forum Discussion
Calculate Percent Change between two columns in Matrix Visuals
I have following table
Date Category Values
| 2021Q2 | B | 10 |
| 2021Q4 | C | 23 |
| 2021Q4 | D | 24 |
| 2021Q1 | A | 56 |
| 2021Q1 | D | 41 |
| 2021Q4 | D | 87 |
| 2021Q4 | A | 90 |
| 2021Q3 | A | 45 |
I want to present it in the Matrix Visuals (it requires to be in Matrix Visuals) where user will choose any two dates from slicer
And I want to add another column to the right of the Matix which will shows percentage change between dates.
output should look like this but in Matrix Visual:
I wrote the following dax but it is not working plus it automatically renders two columns. How can I achive my goals? Any help will be appreciated!
Percentage_Change =
VAR SelectStartDate =
MIN ( 'Table'[Date] )
VAR SelectEndDate =
MAX ( 'Table'[Date] )
VAR CurrentValue =
CALCULATE (
SUM ( 'Table'[Values] ),
FILTER (
'Table',
'Table'[Date] = SelectEndDate
)
)
VAR PreviousValue =
CALCULATE (
SUM ( 'Table'[Values] ),
FILTER (
'Table',
'Table'[Date] = SelectStartDate
)
)
RETURN
( CurrentValue - PreviousValue ) / PreviousValue
where user will choose any two dates from slicerHow are you planning to enforce that?
Here is a version that simply uses the Min and Max quarter, regardless of how many slicer choices are made.
Caveat - you cannot suppress the single value total
Hi,
PBI file attached,
Hope this helps.
2 Replies
- lbendlinSuper User
where user will choose any two dates from slicerHow are you planning to enforce that?
Here is a version that simply uses the Min and Max quarter, regardless of how many slicer choices are made.
Caveat - you cannot suppress the single value total
- Ashish_MathurSuper User