Issue with DAX SamePeriodLastYear

Jubjab

Well-known Member
Joined
Jan 3, 2007
Messages
995
I have a Power Pivot file with sales data, and I follow last week's sales to the previous year's sales. I have a function called "Previous year's sales" which is defined as

=CALCULATE([Total Sales];SAMEPERIODLASTYEAR('Calendar'[Date]))

This has worked fine, but now when I added 2022 to the calendar and try to change the year to 2022 in the report I get the error "only works with contiguous date selections". The Calendar is defined as a calendar table and I added 2022 using the define dates wizard. Everything works fine if I switch between 2020 and 2021 but 2022 gets that error.

Any idea what this could be due to?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Thanks, I tried that but unfortunately didn't work. And actually now I notice that I get the same error if I select week 1 of 2021 so clearly that is causing the issue, i.e. when the week spans over 2 years (using the ISO week).
 
Upvote 0

Forum statistics

Threads
1,215,494
Messages
6,125,145
Members
449,207
Latest member
VictorSiwiide

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top