Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

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  ...
  • bhanu_gautam's avatar
    2 years ago

    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]