Forum Discussion

taylorb's avatar
taylorb
Icon for Helper I rankHelper I
5 years ago
Solved

Default Date Filter to Past and Future Dates

I have a filter in the filter pane for dates and I am trying to default it to the past 3 months, current month, and two future months. Is there a way to use a relative filter for this rather than picking specific dates? If I pick specific dates then it wont update when the month changes. I am assuming that there is no easy way to do this with the filter pane. I want to use it because we have several report filters and we prefer to keep them all in one spot.

  • Hi, taylorb 

     

    According to your description,I think you can create a measure, then use it in filter pane.

    Like this:

    Measure4 = 
    VAR a =
        TODAY ()
    VAR year =
        YEAR ( a )
    VAR month =
        MONTH ( a )
    VAR firstday =
        DATE ( year, month, 1 )
    VAR b =
        EDATE ( firstday, -3 )
    VAR c =
        EOMONTH ( a, 2 )
    RETURN
        IF ( VALUES ( 'Table 2'[Date] ) >= b && VALUES ( 'Table 2'[Date] ) <= c, 1, 0 )

    If it doesn’t solve your problem, please feel free to ask me.

     

    Best Regards

    Janey Guo

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies