Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

How to filter data - current week and next 5 weeks (including weeks in next year)

Hi,    I was using this formula below to filter on current week and next 5 weeks but since the coming weeks are in 2023, this formula it's not working properly..    Any help?    Formula I'm usi...
  • Anonymous's avatar
    Anonymous
    3 years ago

    This solution works also ! 

     

    Date_filter = VAR FIRST_DATE = SWITCH(WEEKDAY(TODAY(),2),

    1,TODAY(),
    2,TODAY()-1,
    3,TODAY()-2,
    4,TODAY()-3,
    5,TODAY()-4,
    6,TODAY()-5,
    7,TODAY()-6
    )

    VAR LAST_DATE = FIRST_DATE + 42

    RETURN

    IF(Dim_Calendar[Calendar Date] >= FIRST_DATE && Dim_Calendar[Calendar Date] < LAST_DATE,"Y","N"

    )