I use SAMEPERIODLASTYEAR() to calculate measure for same period 1 year ago.
How do I do it for same period 2 years ago?
Solved! Go to Solution.
I tried the suggested PARALLELPERIOD function and it skewed dates and values. You can test by just comparing the calc field with one year only using SAMEPERIODLASTYEAR and PARALLELPERIOD.
What has worked for me was DATEADD, so, the mesuare will look like:
measureName =calculate(measure, DATEADD(datetable[date], -2*364, DAY))
This way at least you compare the "same weekday", could be not in the same month but that is what I was after. Use @Anonymous but with DATEADD() suggestion below for other usecases.
I know is 5 yrs ago the question, but worth the contribution!
This was the one that worked for me!
My month selection in my slicer is dynamic, so this let me compare historical YTD numbers (parallelperiod would only give me prior full years)
Good to be mindful of what period type you have in your report.
If you want to see the whole of the year for two years ago then the prior solution is perfect
calculate(measure, parallelperiod(datetable[date], -2, year))
However, if the report is a month by month one then try
calculate(measure, parallelperiod(datetable[date], -24, month))
Are you missing the DATEADD function?
CALCULATE ([Net Sale TY], PARALLELPERIOD('Date'[Date], - 24,MONTH))
I think You need to include the PARALLELPERIOD function name and also a comma before the -24
Please let me know how you go
Click here to read more about the November 2022 updates!
Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.
This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.
Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.