Forum Discussion

srk_powerbi's avatar
srk_powerbi
Helper II
5 years ago
Solved

Help with Custom date slicer values

Hi, I have a requirement to create slicer with custome date values.  The values are   All Current Quarter Last Quarter Last 2 Quarters   So, the visuals on the report needs to show the data a...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi srk_powerbi ,

    You could follow these steps:

    1. Create a single table for Slicer like this:


    2. Use the following formula after
    adding a Quarter column:

     

    Measure =
    VAR _sele =
        SELECTEDVALUE ( forSlicer[Type] )
    RETURN
        SWITCH (
            _sele,
            "ALL", 1,
            "Current Quarter", IF ( MAX ( 'Date'[Quarter] ) = QUARTER ( TODAY () ), 1, 0 ),
            "Last 2 Quarters",
                IF ( QUARTER ( TODAY () ) - MAX ( 'Date'[Quarter] ) >= 1, 1, 0 ),
            "Last Quarter",
                IF ( MAX ( 'Date'[Quarter] ) = QUARTER ( TODAY () ) - 1, 1, 0 )
        )

     

     

     3. Apply the measure to filter pane (set as "=1") . My final output looks like this:

     

    Please take a look at the pbix file here.

     

    Did I answer your question ? Please mark my reply as solution. Thank you very much.
    If not, please upload some insensitive data samples and expected output.

    Best Regards,
    Eyelyn Qin