Forum Discussion
Anonymous
7 years agoNot applicable
Function 'SAMEPERIODLASTYEAR' expects a contiguous selection Issue
Hello, I have a problem using SAMEPERIODLASTYEAR function to calculate the sales YTD. Here is my setup: - I have a databable with date called FACT[InvoiceDate]. Format is date. - I created ...
- 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!
v-jiascu-msft
7 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
Anonymous
7 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!