Forum Discussion
Going back 2 years instead only 1
Hi there
I'm using the SAMEPERIODLASTYEAR-Function. Is there a way to get the year bevor the previous year (2016 YTD + 2015 same period + 2014 same periode)?
Currently in use:
SaleP2YTot = CALCULATE([SaleTot]; SAMEPERIODLASTYEAR('Dates'[Date]))Thanks for any input & Regards!
According to the documentation:
https://msdn.microsoft.com/en-us/library/ee634972.aspx
The dates returned are the same as the dates returned by this equivalent formula:
DATEADD(dates, -1, year)
So perhaps:
DATEADD(dates, -2, year)
3 Replies
- Greg_DecklerCommunity Champion
According to the documentation:
https://msdn.microsoft.com/en-us/library/ee634972.aspx
The dates returned are the same as the dates returned by this equivalent formula:
DATEADD(dates, -1, year)
So perhaps:
DATEADD(dates, -2, year)
- Greg_DecklerCommunity Champion
According to the documentation:
https://msdn.microsoft.com/en-us/library/ee634972.aspx
The dates returned are the same as the dates returned by this equivalent formula:
DATEADD(dates, -1, year)
So perhaps:
DATEADD(dates, -2, year)
- WillbornAdvocate III
Thank you smoupre!
SalesP2YTot = CALCULATE([SalesTot]; DATEADD(Dates[Date]; -2; year))
Did not realized that I have to replace the "sameperiodlastyear"-Function. But it's working well.
What about when calculation the cummulative sales total? Can I use the same functionality like as:
CumSalesP2YTot = CALCULATE ( [SalesPYTot]; FILTER ( ALLSELECTED(Dates); 'Dates'[Date] <= DATEADD(Dates[Date]; -1; year) && 'Dates'[Date] <= TODAY() ) )Regards Patrick