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

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
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,223,677
Messages
6,173,798
Members
452,535
Latest member
berdex

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