Forum Discussion
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.
| Year | Current Year | Previous Year | % difference |
| 2018 | 91 | 57 | 60% |
| 2019 | 52 | 91 | -43% |
| 2020 | 17 | 52 | -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
- amitchandak
Super User
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
Community 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.