Forum Discussion
Same Period Last Year
- 6 years ago@SubinPlus
1) Do you have Dates table marked as Date table? https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-date-tables
2) What context are you viewing these results in? SAMEPERIODLASTYEAR will work in the current context of the report and I believe it also only goes to month granularity, not day as DATEADD will provide, so if you are looking at month of July, it will encompass all dates for July.
3) Try DATEADD(Dates[Date], -365, Day) and that might give closer result to what you're expecting? Note this is slightly different than DATEADD(Dates[Date], -1, Year). Try them both in your report side by side to see the difference. - 6 years ago
Hi Anonymous
try this.
SAMEPERIODLASTYEAR(LASTDATE(Dates[Date]))
1) Do you have Dates table marked as Date table? https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-date-tables
2) What context are you viewing these results in? SAMEPERIODLASTYEAR will work in the current context of the report and I believe it also only goes to month granularity, not day as DATEADD will provide, so if you are looking at month of July, it will encompass all dates for July.
3) Try DATEADD(Dates[Date], -365, Day) and that might give closer result to what you're expecting? Note this is slightly different than DATEADD(Dates[Date], -1, Year). Try them both in your report side by side to see the difference.
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.
- Anonymous6 years agoNot applicable
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