Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Date filter that include 3 previous days

How can I set a date filter that will include the previous 3 days?

Example: I need to run a report Monday through Friday, each day the report will contain items added on the previous calendar day, but on Monday I need to run the report to include Friday - Sunday. I have written 1 query for Tuesday through Friday to pull 1 previous day, but I can not figure out how to set the filter for Monday's reports so it will always include the three previous days.

1 Reply

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Anonymous Sounds like you need a Complex Selector or perhaps something like:

    Measure = 
      VAR __MaxDate = MAX('Dates'[Date])
      VAR __MinDate = __MaxDate - 3
      VAR __Table = FILTER( ALL('Table'), [Date] >= __MinDate && [Date] <= __MaxDate )
      VAR __Result = SUMX( __Table, [Value] )
    RETURN
      __Result

    The Complex Selector - Microsoft Fabric Community