Forum Discussion
Strange behaviour with SAMEPERIODLASTYEAR
- 7 years ago
Hi michaelstone ,
Sorry for my mistake.
Please modify the measure Total Sales - Previous Year like below.
Total Sales - Previous Year = SUMX ( 'Calendar', CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Calendar'[Date] ) ) )Here is the output.
Best Regards,
Cherry
Hi michaelstone ,
By my test and research based on your pbix, I'm afraid that you should create the table with the date column from Calendar table like below so that you could get the correct output.
Best Regards,
Cherry
Hi v-piga-msft ,
My production PBIX does use the Calendard[Date] column but as you can see from your example, the Total at the bottom of the Total Sales - Previous Year column is still incorrect.
I was only using Transactions[Date] in the visualisation because it showed the underlying problem i.e. that the SAMEPERIODLASTYEAR is not working correctly and is including dates to the end of the month.
Thanks,
Michael
- v-piga-msft7 years ago
Resident Rockstar
Hi michaelstone ,
Sorry for my mistake.
Please modify the measure Total Sales - Previous Year like below.
Total Sales - Previous Year = SUMX ( 'Calendar', CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Calendar'[Date] ) ) )Here is the output.
Best Regards,
Cherry
- michaelstone7 years ago
Helper I
This seems like a workaround for an underlying bug but will accept as the solution.
Thanks v-piga-msft