Forum Discussion
SAMEPERIODLASTYEAR NOT WORKING
- 4 years ago
Hi, Anonymous
SAMEPERIODLASTYEAR is a time-intelligent function, so it is recommended to perform this function on a calendar table containing consecutive dates.
Make sure you use
CALCULATE([Measure], SAMEPERIODLASTYEAR(Calendar[Date]))rather than
CALCULATE([Measure], SAMEPERIODLASTYEAR(Facttable[Date]))You can also try using filter and DATEADD . The dates returned by SAMEPERIODLASTYEAR are the same as the dates returned by this equivalent formula:
DATEADD(dates, -1, year)Other related threads:
Function 'SAMEPERIODLASTYEAR' expects a contiguous selection Issue
Contiguous date selection error - YTD LY
sameperiodlastyear only works with contiguous date selection
Best Regards,
Community Support Team _ Eason
Adding this solution in case others had the same experience as me. I was getting the 'Function 'SAMEPERIODLASTYEAR' only works with contiguous date selections' error message on a file that had updated monthly for the past year without issue. The error appeared after refreshing the data with a dataflow. During fault finding I tested refreshing the file on a colleague's laptop and it worked fine so I knew I had an issue with my laptop rather than the file itself.
The solution on my laptop was a simple clearing of the Excel cache. As soon as the Excel cache was clear, the file refreshed without the error message coming back and everything worked fine again.