Forum Discussion
vanessafvg
9 years agoCommunity Champion
SAMEPERIODLASTYEAR not working as expected
I have this calcualted measure, but it doesn't bring anything back - i can see data for last year so its a bit odd PY Revenue = CALCULATE(sum(Sales[RevenueNettAmount]), SAMEPERIODLASTYEAR('Fiscal D...
- 9 years ago
My guess on this is that you are filtering Fiscal Date[Date] through your slicers and so when you feed it to SAMEPERIODLASTYEAR in a measure, it is filtered to a single month/year and thus all of last year's information is not there. I would try wrapping an ALL around 'Fiscal Date'[Date]) to remove any slicer filter context.
nandic
6 years agoResident Rockstar
Try this approach: mark you date dimension as date dimension (screenshot below).
After having this, you use date column from this dimension to get same period last year.
Example:
Total Sales PY = CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Date'[Date]))
Table 'Date' is marked as Date dimension.
Result is list below:
Cheers,
Nemanja