Forum Discussion
SAMEPERIODLASTYEAR returns bank
- Anonymous8 years ago
Hi
It's because your Slicer is using a calculated column and your measure for Same period last year is using another column.
The sameperiodlastyear function must use the same column that you are filtering with your slicer.
Hi elahemeydani
Are you sure that the date column that you choose in the year is the same as [FullDateAlternateKey]?
If so can you perhaps provide a sample of the file?
Alternatively you can try this small workaround:
Profit SPLY :=
VAR MinLY =
EDATE ( MIN ( Date'[FullDateAlternateKey]' ); -12 )
VAR MaxLY =
EDATE ( MAX ( Date'[FullDateAlternateKey]' ); -12 )
RETURN
CALCULATE([Total Profit] ; FILTER(ALL('Date') ; 'Date'[FullDateAlternateKey]' <= MaxLY && Date'[FullDateAlternateKey]' >= MinLY))
Best Regards
KMW
Thank you for answering so quickly.
W
hen I select no YEAR from the Slicer, it works just perfectly, but when a YEAR is selected, the LY values are blank
Below you can see a screenshot of the Date table :
- Anonymous8 years agoNot applicableIs the year date slicer also using the fulldatealternatekey column?
- Anonymous8 years agoNot applicable
For the Slicer I used :
Year = YEAR('Date'[FullDateAlternateKey])Now that I replace the slicer with FullDateAlternateKey, it is working perfectly.
But why ??:smileyfrustrated:
- Anonymous8 years agoNot applicable
Hi
It's because your Slicer is using a calculated column and your measure for Same period last year is using another column.
The sameperiodlastyear function must use the same column that you are filtering with your slicer.