Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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 problem, so I was wondering if there was an alternative to coming up with PY Sales:
PY Sales Dollars = CALCULATE([Sales Dollars],SAMEPERIODLASTYEAR('Sales'[Date]), ALL('Time'))
Thanks!
Solved! Go to Solution.
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.
I think you will need to insert records into your 'Time' table for the future dates no matter what the solution, as any visuals you create will not just come up with the future dates for you. If you do this, doesn't the PY Sales Dollars show up for future periods even if the current year Sales are blank?
I do have future dates for the Time dimension, but the lack of actuals in the current year are preventing this function from working for the future months.
Here's an example of it working for me:
I have a Revenue measure:
Revenue = SUM(Sales[Order Revenue])
Then I have an LY Revenue measure:
LY Revenue = CALCULATE([Revenue],SAMEPERIODLASTYEAR('Calendar'[Date])
I have data going through the end of March 2017 in my sales data, but I have entries in my 'Calendar' table all the way through to the end of 2017. When I create a table with Date, Revenue and LY Revenue, the LY Revenue continues to populate for future dates even though there is no current date data available for that period:
It works with different granularities or in other visuals as well:
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.
Thank you!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
97 | |
78 | |
63 | |
55 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |