cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
wmorris20 Helper II
Helper 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 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!

1 ACCEPTED SOLUTION

Accepted Solutions
bblais Resolver III
Resolver III

Re: Alternative for SAMEPERIODLASTYEAR()

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.

View solution in original post

6 REPLIES 6
bblais Resolver III
Resolver III

Re: Alternative for SAMEPERIODLASTYEAR()

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?

wmorris20 Helper II
Helper II

Re: Alternative for SAMEPERIODLASTYEAR()

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.

bblais Resolver III
Resolver III

Re: Alternative for SAMEPERIODLASTYEAR()

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:

 

Capture.PNG

 

bblais Resolver III
Resolver III

Re: Alternative for SAMEPERIODLASTYEAR()

It works with different granularities or in other visuals as well:

 

Capture.PNG

bblais Resolver III
Resolver III

Re: Alternative for SAMEPERIODLASTYEAR()

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.

View solution in original post

wmorris20 Helper II
Helper II

Re: Alternative for SAMEPERIODLASTYEAR()

Thank you!

Helpful resources

Announcements
Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We've launched a how-to forum where you can learn about how Power BI integrates with other Power Platform products.

Top Solution Authors
Top Kudoed Authors