Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Robbief
Helper II
Helper II

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
mattbrice
Solution Sage
Solution Sage

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

View solution in original post

2 REPLIES 2
mattbrice
Solution Sage
Solution Sage

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

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/

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors