Forum Discussion
SAMEPERIODLASTYEAR expects a contiguous selection
Hello all,
I have the following measure:
I'm getting the following error message:
8 Replies
- DataZoeMicrosoft Employee
I ran into a similar issue. Is your Date Dim a calculated table in Power BI that is getting the start/end dates from another table?
- amitchandakSuper User
StephenK , you to remove bi-directional join as that is causing date in date dimension also getting filtered.
Make it only one-directional 1- Many from date to Data table
- v-deddai1-msftCommunity Support
Hi StephenK ,
In addition to amitchandak's reply, you should make it only one-directional 1- Many from date to Data table. Because bi-directional join as that may cause date in date dimension also getting filtered. if you are trying to use these time intelligence functions like SAMEPERIODLASTYEAR or DATEADD, It needs a contiguous interval in date column.
If there is a filter to remove rows from the middle. Same period last year wants to look at just exactly 1 "period" -- that can be a week, day, month, 4.6 weeks... but they need to be 1 continuous range not like "the 1st and 4th week of July" (which would have a gap... in the 2nd and 3rd weeks, and is not allowed).
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
- StephenKResolver I
Thanks for the responses everyone. amitchandak v-deddai1-msft i already checked that... Am I missing something obvious?
- v-deddai1-msftCommunity Support
Hello @StephenK ,
Could you check the relationship between Fact_Schedule and Date Dim? Must be unidirectional 1- Many.
As a workaround, you can avoid using the time intelligence feature. See https://community.powerbi.com/t5/Desktop/Function-SAMEPERIODLASTYEAR-expects-a-contiguous-selection-Issue/m-p/583072
Best regards
Dedmon Dai
- StephenKResolver I
v-deddai1-msft I've already checked that. Please see my previous screenshot for verification. I've looked into the workaround you suggested. I'm not finding a good application for it because I need my SAMEPERIODLASTYEAR measure to be visualized by month.