Forum Discussion
Calcualte Last 3 Years Average
Hello,
I have the below dataset, I created the Financial Year column in the below dataset. Financial Year Starts on July 1st and ends on June 30th.
| Week | Value | Financial Year |
| 2017-06-W1 | 30 | 2017 |
| 2017-06-W2 | 40 | 2017 |
| 2017-07-W1 | 50 | 2018 |
| 2017-07-W2 | 40 | 2018 |
| 2018-07-W1 | 30 | 2019 |
| 2018-O7-W2 | 50 | 2019 |
| 2019-07-W1 | 60 | 2020 |
| 2019-07-W2 | 40 | 2020 |
2020-07-W1 | 30 | 2021 |
2020-07-W2 | 40 | 2021 |
What I am looking for is
IF( [Financial Year]=2021, ([2020]+[2019]+[2018]/3),
IF([Financial Year]<=2020, ([2019]+[2018]+[2017]/3)))
In the below chart, I need to show last 3 years average instead of 2017-2019 average.
If 2021 is present I shouldn't show 2020 in the column below chart, I should show the 2018-2020 average and 2021 column in the below chart.
Please let me know how to do it.
Thank you!
Anonymous , You can use a rolling measure. if required divide with the distinct count of year
Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-3,YEAR))/3 Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max(Sales[Sales Date]),-3,YEAR)) /3
2 Replies
- amitchandakSuper User
Anonymous , You can use a rolling measure. if required divide with the distinct count of year
Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-3,YEAR))/3 Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max(Sales[Sales Date]),-3,YEAR)) /3 - v-juanli-msftCommunity Support
Hi Anonymous
Does this article give you any idea?
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.