Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
The dax function Same Period Last Year DAX is not giving the actual dates shifted by 1 Year back.
This calculates till the end of the month previous year and not to the same day last year.
LASTDATE(Dates[Date)) gives me 2020/7/26, but LASTDATE(SAMEPERIODLASTYEAR(Dates[Date])) gives me 2019/7/31, which is not the same period.
This is a serious bug which makes the calculations wrong
Solved! Go to Solution.
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
Hi @Anonymous
try this.
SAMEPERIODLASTYEAR(LASTDATE(Dates[Date]))
Hi @Anonymous
try this.
SAMEPERIODLASTYEAR(LASTDATE(Dates[Date]))
@Anonymous
You must have DATES for the full year, make sure your dates are until 31 DEC 2020
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
I accept KUDOS 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
Hi Allison,
Date table is already marked a date table.
The report doesn't have any filters applied and calendar table contains dates from 1/1/2019 to 26/7/2020.
I was in the impression that SAMEPERIODLASTYEAR gives day level granularity and not month level.
This behaviour doesn't give much value in terms of comparison as this is not accurate if you are in middle of any month.
I will try as per your suggestion. Thank a lot.
HI @Anonymous,
I'd like to suggest you try to use the date function to manly calculate out the date range what you wanted.
It should more agility than time intelligence functions and it supports a few advanced operations. (e.g. nested, filter with specific rules based on current value and calculations)
Time Intelligence "The Hard Way" (TITHW)
Regards,
Xiaoxin Sheng
@Anonymous
You are supposed to get the same date less one year. Both DATEADD works the same way.
________________________
Did I answer your question? Mark this post as a solution, this will help others!.
I accept KUDOS 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hi @Anonymous ,
what value do you expect for the period?
I expect the end date of same period last year dax to be 26/7/2019. Today is 26/7 2020, so the same period last year should be from 1/1/2019 til 26/7/2019. But i get dates from 1/1/2019 till 31/7/2019 which is wrong.
Please find below the scrrenshots for better understanding
Below is the last date from the calendar table.
Below is the last date for the same period last year which gives 7/31/2019. Ideally it should be 7/26/2019.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
85 | |
68 | |
59 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |