Forum Discussion

AmritaOS's avatar
AmritaOS
Helper I
5 years ago
Solved

Power Pivot - Calculate difference and % difference

Hi All, i have the below pivot table and want to calculate the difference in avg cost from 2020 to 2021 and the % difference of teh same. in the piviot table source the year is a single column named ...
  • rfigtree's avatar
    5 years ago

    Could get all fancy but if simple one off. Something like this.

    Avg2020:=calculate(....,filter(all(table,date),year=2020)

    Same for 2021

    Difference measure just subtract the two measures. Percent difference measure is divide(difference measure,2020measure)

  • AmritaOS's avatar
    5 years ago

    Hi All

    this is what i did eventually:

    CALCULATE([Average cost, TableName(column) = "2020"]) 

    CALCULATE([Average cost, TableName(column) = "2021"]) 

    % Difference = 

    =IF(

    OR([Avg Part Cost 2020]<=0, [Avg Part Cost Post 2021]<=0),"na",[Avg Part Cost 2021]-[Avg Part Cost 2020])