Forum Discussion

DCWork's avatar
DCWork
New Member
1 year ago
Solved

Previous Year Calculation

Morning,   I have a calculation to show a date range of the previous Sunday-Saturdy.  Which I am using as a filter.  However I need to take same date range and show it for the previous year.  My Su...
  • rajendraongole1's avatar
    1 year ago

    Hi DCWork  - you can simply shift the calculated LastSunday and LastSaturday back by 1 year using EDATE or DATEADD

     

    use the below measure:

    _Is_Last_Week_PY =
    VAR TodayDate = TODAY()
    VAR LastSaturday = TodayDate - WEEKDAY(TodayDate, 1)
    VAR LastSunday = LastSaturday - 6

    VAR LastSaturday_PY = EDATE(LastSaturday, -12)
    VAR LastSunday_PY = EDATE(LastSunday, -12)

    RETURN
    IF (
    'DimDate'[Date] >= LastSunday_PY &&
    'DimDate'[Date] <= LastSaturday_PY,
    TRUE,
    FALSE
    )

    Hope this helps.