Forum Discussion

AOD's avatar
AOD
Icon for Helper III rankHelper III
4 years ago
Solved

Perform calculation only for latest year

Hi All, 

 

Need help in doing calculation for % difference only for recent year ( say data in table is for 2020 only so it should calculate for 2020)

Moving further id there is dta for 2021 , it should derive % difference for 2021.

as per data below I need %difference only for 3rd row rest will be blank.

YearCurrent YearPrevious Year% difference
2018915760%
20195291-43%
20201752-67%
    
  • Hi, AOD 

     

    You can try the following methods.

     

    % difference =
    DIVIDE ( [Current Year] - [Previous Year], [Previous Year] )
    

     

    If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • AOD , Try a measure like

     

    measure =
    var _max = maxx(all('Table'),'Date1'[Table])
    var _min = _max -1
    var _this = calculate(sum(Table[Value]), filter(Table, Table[Year] = _max))
    vat _last = calculate(sum(Table[Value]), filter(Table, Table[Year] = _min))
    return
    divide(_this -_last, _last)

     

     

    Power BI — Year on Year with or Without Time Intelligence
    https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
    https://www.youtube.com/watch?v=km41KfM_0uA

  • v-zhangti's avatar
    v-zhangti
    Icon for Community Support rankCommunity Support

    Hi, AOD 

     

    You can try the following methods.

     

    % difference =
    DIVIDE ( [Current Year] - [Previous Year], [Previous Year] )
    

     

    If the method I provided above can't solve your problem, what's your expected result? Could you please provide more details for it?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.