Forum Discussion

Vasek00005's avatar
Vasek00005
Helper I
2 years ago

Let user toggle between slicers

Hi,

I have a report where users want to filter date in different ways. Sometimes they need slicer between dates and sometimes they need slicer with relative dates. I need to let them decide which slicer should be active and then totally deactivate the other one. Hiding the visual is not a solution as it still filters the report.

I use a bookmark now that toggles between the slicers. And the hidden slicer always has to be set to the widest range as possible so it not interfers the active one. But the downside of this solution is that the bookmark sets the slicer always to the same dafault dates that is unconfortable for users.

Any idea how to simple dynamicly activate/deactivate the slicer? I don't want to hide it and set dates as widest as possible. I want to toggle its entire activation.

Thanks,

vašek

3 Replies

  • Hi, thanks for reply. I user parameters for different tasks but have no idea how to implement them to dynamically activate/deactivate whole slicer. What was your idea?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Vasek00005 

     

    My solution is as follows, you can try it out.

    • Create three auxiliary tables, two for dates(eg:BetweenDateTable, RelativeDateTable) and one for slicer selection(eg:Slicer).

     

     

     

     

     

     

     

     

     

     

     

    • Create slicers for these three tables separately.

     

     

     

     

     

     

     

     

    • To allow users to choose between the two date slicers, create a measure like as below:

    Measure =

    var _sel=SELECTEDVALUE(Slicer[Slicer Choice])

    return

    SWITCH(_sel,"Between",IF(ISFILTERED(BetweenDateTable[BetweenDate]),IF(MIN(Sheet1[date]) in ALLSELECTED(BetweenDateTable[BetweenDate]),1),1), "RelativeDate",IF(ISFILTERED(RelativeDateTable[RelativeDate]),IF(MAX(Sheet1[date]) in ALLSELECTED(RelativeDateTable[RelativeDate]),1),1)

    )

     

    • Use this measure in your visuals, and apply filter to "is" "1".

     

     

     

     

     

     

     

     

     

    • Here's my final result, when select one slicer, the other is deactivated.

     

     

     

     

     

     

     

     

     

     

     

    I hope this solution meets your requirements.

     

     

    Best Regards,

    Jarvis Tang

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