March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello
Can you help me to solve this issu please ?
In the card I want to show the result of the previous year in the same period YTD n-1 51246
And the details show this
Solved! Go to Solution.
Hi @yamina ,
First of all I think the SAMEPERIODLASTYEAR function requires the Date data type, which is the reason for the wrong result you reported.
I create a table as you mentioned and make it as a matrix.
Then I create a measure and here is the DAX code you can refer.
YTD n-1 =
CALCULATE(SUM('Table'[Total]), 'Table'[Year] = 2023)
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @yamina ,
First of all I think the SAMEPERIODLASTYEAR function requires the Date data type, which is the reason for the wrong result you reported.
I create a table as you mentioned and make it as a matrix.
Then I create a measure and here is the DAX code you can refer.
YTD n-1 =
CALCULATE(SUM('Table'[Total]), 'Table'[Year] = 2023)
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for you quick feedback but I try to use DATEADD also, but it doesnt't work. the same error appears
@yamina You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000
Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
And especially this alternative to SAMEPERIODLASTYEAR: To **bleep** With DATEADD - Microsoft Fabric Community
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
94 | |
94 | |
82 | |
50 |
User | Count |
---|---|
205 | |
161 | |
93 | |
89 | |
72 |