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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
gbii1970
Regular Visitor

Prior Corresponding Period

I have a period in YYYYQn format (e.g. 2021Q1) coded in the SQL Server backend, with associated measures. How can I get the same measures from the corresponding period from the previous year from this using DAX?

 

Thanks!

2 ACCEPTED SOLUTIONS
DataInsights
Super User
Super User

@gbii1970,

 

You can use the function SAMEPERIODLASTYEAR. Example:

 

Measure 1 LY = CALCULATE ( [Measure 1], SAMEPERIODLASTYEAR ( DimDate[Date] ) )

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

v-xulin-mstf
Community Support
Community Support

Hi @gbii1970

 

You can try measure like:

= DATEADD(DateTime[DateKey],-1,year)  
= CALCULATE(SUM(ResellerSales_USD[SalesAmount_USD]), SAMEPERIODLASTYEAR(DateTime[DateKey]))  

For more information, you can refer:

SAMEPERIODLASTYEAR function (DAX) - DAX | Microsoft Docs

DATEADD function (DAX) - DAX | Microsoft Docs

 

If you still have some question, please don't hesitate to let me known.‌‌

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

View solution in original post

2 REPLIES 2
v-xulin-mstf
Community Support
Community Support

Hi @gbii1970

 

You can try measure like:

= DATEADD(DateTime[DateKey],-1,year)  
= CALCULATE(SUM(ResellerSales_USD[SalesAmount_USD]), SAMEPERIODLASTYEAR(DateTime[DateKey]))  

For more information, you can refer:

SAMEPERIODLASTYEAR function (DAX) - DAX | Microsoft Docs

DATEADD function (DAX) - DAX | Microsoft Docs

 

If you still have some question, please don't hesitate to let me known.‌‌

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

DataInsights
Super User
Super User

@gbii1970,

 

You can use the function SAMEPERIODLASTYEAR. Example:

 

Measure 1 LY = CALCULATE ( [Measure 1], SAMEPERIODLASTYEAR ( DimDate[Date] ) )

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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