Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
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!
Solved! Go to Solution.
You can use the function SAMEPERIODLASTYEAR. Example:
Measure 1 LY = CALCULATE ( [Measure 1], SAMEPERIODLASTYEAR ( DimDate[Date] ) )
Proud to be a Super User!
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!
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!
You can use the function SAMEPERIODLASTYEAR. Example:
Measure 1 LY = CALCULATE ( [Measure 1], SAMEPERIODLASTYEAR ( DimDate[Date] ) )
Proud to be a Super User!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 64 | |
| 63 | |
| 49 | |
| 21 | |
| 18 |
| User | Count |
|---|---|
| 121 | |
| 118 | |
| 38 | |
| 36 | |
| 29 |