Forum Discussion
Previous Year average and 2 year average
- 6 years ago
I managed to solve it my self, once I got inspired by amitchandak's solution. 🙂
Its
Average last year = CALCULATE(SUM('Erlöse'[Betrag])/12;PREVIOUSYEAR(Datumstabelle[Date]);'Erlöse'[Positionsart] IN { "Miete" } )
and
Average second to last year = CALCULATE(SUM('Erlöse'[Betrag])/12;PARALLELPERIOD(Datumstabelle[Date];-2;YEAR);'Erlöse'[Positionsart] IN { "Miete" } )
Simple as that... ^^
Thanks all
Thanks for your post! This seems promising, but I didn't get the expected result back.
I probably explained it not to the fully extent.
I need (looking from 2019) the average of 2018, namely from 01.01.18 - 31.12.18 and from 2017 (vice versa)
No year to date calculations.
Btw, I do have a date table. To give it some "flesh", I uploaded the basic pbix which translates to the big pbix.
https://www.dropbox.com/s/u4wmq7puu5mzl05/Showcase.pbix?dl=0
I would expect the "Previous Year Average" to be at 4333 in 2018, as the sum of 2017 is 52K.
Thanks also!
I couldn't get your code to work though. It doesn't seem to understand this part:
The [Year] seems to be the problem. Why so?
Thanks so far you two!
I managed to solve it my self, once I got inspired by amitchandak's solution. 🙂
Its
Average last year = CALCULATE(SUM('Erlöse'[Betrag])/12;PREVIOUSYEAR(Datumstabelle[Date]);'Erlöse'[Positionsart] IN { "Miete" } )
and
Average second to last year = CALCULATE(SUM('Erlöse'[Betrag])/12;PARALLELPERIOD(Datumstabelle[Date];-2;YEAR);'Erlöse'[Positionsart] IN { "Miete" } )
Simple as that... ^^
Thanks all