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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
eduardoa
Advocate I
Advocate I

Getting YTD value instead of SAMEPERIODLASTYEAR

Hello,

Need to show the Same Period Last Year from a measure, but  the result shows the Year To Date value.

LYTD =

CALCULATE([my measure ],
SAMEPERIODLASTYEAR(DimDates[Date]))


Already tried this basic formula and many variations using PARALLELPERIOD,  DATEADD, etc. but the result allways shows YTD instead of SPLY.

Will appreciate any suggestion.
Thanks beforehand

 
2 ACCEPTED SOLUTIONS
rubayatyasmin
Super User
Super User

Hi, @eduardoa 

 

rubayatyasmin_0-1690954981394.png

Meaning,  today's date is August 2nd, 2023, then the SAMEPERIODLASTYEAR function returns dates from January 1, 2022, to August 2, 2022, hence why it looks like a YTD calculation.

 

* Do you want to calculate [my measure] for the complete previous year? then use DATEADD 

* if you want to calculate [my measure] for the complete previous year till today's date, use DATESYTD with DATEADD. 

for example. 

 

DATESYTD( DATEADD(DimDates[Date], -1, YEAR) )

 

this would calculate [my measure] for the period from jan 1, 2022, to aug 2, 2022 as today is aug 2, 2023. 

 

refer: https://learn.microsoft.com/en-us/dax/sameperiodlastyear-function-dax

https://learn.microsoft.com/en-us/dax/dateadd-function-dax

https://learn.microsoft.com/en-us/dax/datesytd-function-dax

 

see if this thread helps you

Solved: SAMEPERIODLASTYEAR() - Microsoft Fabric Community

 

rubayatyasmin_0-1689517080227.png

 

 


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


View solution in original post

Hello @rubayatyasmin 

Thanks so much for your help!

View solution in original post

2 REPLIES 2
rubayatyasmin
Super User
Super User

Hi, @eduardoa 

 

rubayatyasmin_0-1690954981394.png

Meaning,  today's date is August 2nd, 2023, then the SAMEPERIODLASTYEAR function returns dates from January 1, 2022, to August 2, 2022, hence why it looks like a YTD calculation.

 

* Do you want to calculate [my measure] for the complete previous year? then use DATEADD 

* if you want to calculate [my measure] for the complete previous year till today's date, use DATESYTD with DATEADD. 

for example. 

 

DATESYTD( DATEADD(DimDates[Date], -1, YEAR) )

 

this would calculate [my measure] for the period from jan 1, 2022, to aug 2, 2022 as today is aug 2, 2023. 

 

refer: https://learn.microsoft.com/en-us/dax/sameperiodlastyear-function-dax

https://learn.microsoft.com/en-us/dax/dateadd-function-dax

https://learn.microsoft.com/en-us/dax/datesytd-function-dax

 

see if this thread helps you

Solved: SAMEPERIODLASTYEAR() - Microsoft Fabric Community

 

rubayatyasmin_0-1689517080227.png

 

 


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Hello @rubayatyasmin 

Thanks so much for your help!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.