Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Setting Report wide date range - new user

Hello,

 

I have turned off the Time intellegence option for this report, as I am running in an A1 licience.  I have a timeframe filter that will define the date range of my report. I am required to use the following values in the filter: Year-to-date, Rolling 12 months, 2021, 2020, 2019. I do not know how to set a report-wide filter that for a date range. I beleive I have to set the time boundry in the 'Filters on all pages' filter section, but am not sure how.

Do I create a measure for the beginning time (always today) and then a measure for the end time based on the selected filter option? What are your suggestions?

 

Cheers!

 

2 Replies

  • Hi Anonymous ,

     

    To my knowledge, Power BI accepts measures as filters only at a single visual level, and it does not accept measures as filters at the page level nor at the report level.

    Here is my method to solve your problem:

    • First, create a new table with all the options you need in the slicer.

             

    • Then create a measure that filters the date.

     

     

    Measure = 
    SWITCH (
        MAX ( 'For Slicer'[Value] ),
        "Rolling 12 months",
            IF (
                MAX ( 'Data'[date] ) >= EDATE ( TODAY (), -12 )
                    && MAX ( 'Data'[Date] ) <= TODAY (),
                1,
                0
            ),
        "Year-to-date",
            IF (
                MAX ( 'Data'[Date] ) >= DATE ( YEAR ( TODAY () ), 1, 1 )
                    && MAX ( 'Data'[Date] ) <= TODAY (),
                1,
                0
            ),
        IF (
            YEAR ( MAX ( 'Data'[Date] ) ) = CONVERT ( MAX ( 'For Slicer'[Value] ), INTEGER ),
            1,
            0
        )
    )

     

     

    • Apply the measure to the visual - level filter , set "is 1":

             Final output:

             

               

    Best Regards,

    Jianbo Li

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