Forum Discussion
How to calculate difference between years
Hi, I would like to have this pivot table where the "difference" is calculated as the difference between (value year)- (value prevoious year)
So like: value 2023-2022, 2022-2021, 2021-2020
How ca I do?
(I also would like to order the table with descending years if possible)
Anonymous , Create a calculated column for the previous year's value:
PreviousYearValue =
CALCULATE(
SUM('YourTable'[Value]),
FILTER(
'YourTable',
'YourTable'[Year] = EARLIER('YourTable'[Year]) - 1
)
)One more for difference
Difference = 'YourTable'[Value] - 'YourTable'[PreviousYearValue]
1 Reply
- bhanu_gautamSuper User
Anonymous , Create a calculated column for the previous year's value:
PreviousYearValue =
CALCULATE(
SUM('YourTable'[Value]),
FILTER(
'YourTable',
'YourTable'[Year] = EARLIER('YourTable'[Year]) - 1
)
)One more for difference
Difference = 'YourTable'[Value] - 'YourTable'[PreviousYearValue]