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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anders_G
Helper I
Helper I

Need a sameperiodlastyear type formula to dynamically compare current and last year.

Hey there!

 

I'm in need of a dynamic same period last year comparison between 2022 and 2021. Currently my SAMEPERIODLASTYEAR formula returns the below results giving me a full last year comparison against the current year.

SUM LY Sameperiod = CALCULATE(sum('My Dataset'[Amount]), SAMEPERIODLASTYEAR('Date Table'[Date]))

 

I would like a formula that returns last year data for the same period as I have current year data ie. Jan 1 - Nov 23 for both 2022 and 2021. The report will update every day adding another day and it should be reflected in the report. I do not want to use manual filters like slicers.

 

Thank you very much!

 

Anders_G_0-1669301258317.png

 

1 REPLY 1
Shahfaisal
Solution Sage
Solution Sage

The SAMEPERIODLASTYEAR function uses full period for comparison. Take a look at the solution provided in this article - https://radacad.com/same-period-last-year-to-date-dax-calculation-in-power-bi

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors