Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Deviation Formula - Dax year wise

i have three 4 years data in my table . actuals values for  following 4 years  2019,2020,2021,2022                2019        2020     2021    2022 Jan                         100       345     56...
  • amitchandak's avatar
    4 years ago

    Anonymous , Unpivot this data have year on rows

    https://radacad.com/pivot-and-unpivot-with-power-bi

     

    then try measure like these and take diff

     

    This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Year'),'Year'[Year]=max('Date'[Year])))
    Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Year'),'Date'[Year]=max('Date'[Year])-1))

     

    diff = [This Year]-[Last Year ]
    diff % = divide([This Year]-[Last Year ],[Last Year ])

     

     

     

     

    Have year table

    year = distinct(Table[year])