Forum Discussion
wmorris20
9 years agoHelper II
Alternative for SAMEPERIODLASTYEAR()
We are looking to generate forecasts based on the prior year. SAMEPREIODLASTYEAR works fantastic until you get to a future month. I'd prefer not to insert blank future records in order to "fix" the...
- 9 years ago
I see what it is. You have to use the 'Time' dimension's date field in your SAMEPERIODLASTYEAR call, not the 'Sales' table which won't have values for the future dates. And you don't need that ALL('Time') filter:
PY Sales Dollars = CALCULATE([Sales Dollars],SAMEPERIODLASTYEAR('Time'[Date]))This assumes your date field that you join on is 'Time'[Date], adjust accordingly if it's not.
bblais
9 years agoResolver III
I see what it is. You have to use the 'Time' dimension's date field in your SAMEPERIODLASTYEAR call, not the 'Sales' table which won't have values for the future dates. And you don't need that ALL('Time') filter:
PY Sales Dollars = CALCULATE([Sales Dollars],SAMEPERIODLASTYEAR('Time'[Date]))This assumes your date field that you join on is 'Time'[Date], adjust accordingly if it's not.
wmorris20
9 years agoHelper II
Thank you!