Forum Discussion

sridharpolina's avatar
4 years ago
Solved

Relative date filtering including future dates

Hi, I am trying to dynamically filter a date which includes future dates as well. For Ex. For March 2022 I need a query which looks at the previous 12 months and the next 12 months (March2021-March20...
  • johnt75's avatar
    4 years ago

    You could add a column to your date table for filtering purposes, something like

    Within 24 month window =
    var startDate = EOMONTH( TODAY(), -13) + 1
    var endDate = EOMONTH( TODAY(), 12 )
    return IF( 'Date'[Date] >= startDate && 'Date'[Date] <= endDate, 1, 0)

    then add that filter to your visuals