Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Same Period Last Year

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...
  • AllisonKennedy's avatar
    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.
  • mwegener's avatar
    6 years ago

    Hi Anonymous 

     

    try this.

    SAMEPERIODLASTYEAR(LASTDATE(Dates[Date]))