Forum Discussion
Function 'SAMEPERIODLASTYEAR' expects a contiguous selection Issue
- Anonymous7 years ago
Hi v-jiascu-msft,
I am using filter instead as follow:
TOTAL SALES YTD =
CALCULATE (
SUM (FACT[Sales] ),
FILTER (
ALL ( 'Date' ),
YEAR ( 'Date'[Date] ) = YEAR ( TODAY () )
&& 'Date'[Date] <= TODAY ()
)
)Thanks all for your help!
Try deleting and recreating the relationship. The dates table should not have multiple rows for the same date.
If your dates table has duplicate dates, then something is likely wrong with it.
I deleted and re-created the link but same issue.
I also created a new date table : Date = CALENDAR(DATE(2016,1,1), today()), same issue with the relationship
In my date table, there is no duplication and I am using format Date.
- Anonymous7 years agoNot applicable
Hi v-jiascu-msft,
I am using filter instead as follow:
TOTAL SALES YTD =
CALCULATE (
SUM (FACT[Sales] ),
FILTER (
ALL ( 'Date' ),
YEAR ( 'Date'[Date] ) = YEAR ( TODAY () )
&& 'Date'[Date] <= TODAY ()
)
)Thanks all for your help!
- v-jiascu-msft7 years agoMicrosoft Employee
Hi Anonymous,
The relationship could be the root cause. Can you change it to 1:* manually? Please also check if there are any duplicates. Please refer to the snapshot below.
The SAMEPERIODLASTYEAR works now after the release of the Composite model.
Best Regards,
Dale - Anonymous7 years agoNot applicable
Hi v-jiascu-msft,
Thank you for the explaination.
I finally found another way to calculate sale year to date using filter instead of SAMEPERIODLASTYEAR.
It is working quite fine now.
Thank you!
- Anonymous7 years agoNot applicable
Hi v-jiascu-msft,
Thank you for the explaination.
I finally found another way to calculate sale year to date using filter instead of SAMEPERIODLASTYEAR.
It is working quite fine now.
Thank you!
- v-jiascu-msft7 years agoMicrosoft Employee
Hi Anonymous,
I'm glad you solved it. Can you share the solution, please? Please also close this thread.
Best Regards,
Dale
