Forum Discussion
Previous Year Calculation
- 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 - 6VAR 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.
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.
that's great, thanks for that.