cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Robbief Regular Visitor
Regular Visitor

The dreaded "SAMEPERIODLASTYEAR" Function

Hi Guys - I was wondering if someone could perhaps help....  I've spent a day on this, read just about every forum post, but I'm clearly missing something in relation to the SAMEPERIODLASTYEAR function.

 

Details:

I have a Transaction DB - Consumed into PowerBi via Odata

I have a seperate Calendar DB I created in PowerBi (Well formed)

 

On the transaction DB - I have created the following measures:

Sum of Sales -->  Sum of Sales = SUM (Transactions[amount])

Year to Date Sum of Sales -->  YTDSumOfSales = TOTALYTD([Sum of Sales],'CALENDAR'[Date])

Last Year Sales -->  SalesLastYTD = CALCULATE([YTDSumOfSales], SAMEPERIODLASTYEAR('CALENDAR'[Date]))

 

For some reason the Last Year Sales Measure is moving the measure ahead; instead of behind (IE - 2018, insted of 2016) - Here is what the table of the data looks like the below.

 

Essentially I am trying to create some KPI Scorecards to show you how you are trading against Last YTD / Last MTD / Last WTD / This Week vs Last Year This Week / Today vs Today Last Year.

 

Any direction would be well recieved!

PowerBi.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
mattbrice Senior Member
Senior Member

Re: The dreaded "SAMEPERIODLASTYEAR" Function

Not sure what you mean. Results look as expected.  2017 SalesLastYTD is showing 2016 YTDSumOfSales, etc.  

2 REPLIES 2
Highlighted
mattbrice Senior Member
Senior Member

Re: The dreaded "SAMEPERIODLASTYEAR" Function

Not sure what you mean. Results look as expected.  2017 SalesLastYTD is showing 2016 YTDSumOfSales, etc.  

Robbief Regular Visitor
Regular Visitor

Re: The dreaded "SAMEPERIODLASTYEAR" Function

Thanks for pointing out the obvious to me.  I ended up going in circles; and getting confused with the Sameperiodlastyear / parrallelperiod / dateadd.....  But I realised I was being stupid, and after reading a few more articles, i figured it out. 

 

This really helped:

https://www.kasperonbi.com/powerpivot-dax-parallelperiod-vs-dateadd/