Forum Discussion

BJankic's avatar
BJankic
Icon for Helper II rankHelper II
1 year ago
Solved

Show/Hide Date Slicer Based on Period Selection

Hi everyone,

 

I’m trying to implement logic where the Date slicer is only shown when the Period slicer option “Custom” is selected.

  • When “Custom” is selected → the Date slicer should be enabled/visible so the user can pick a custom range.

  • When any of the other options (MTD, QTD, YTD, Rolling, etc.) are selected → the Date slicer should be hidden/disabled.

Here are the screenshots for context:

  • Date slicer: Date Slicer

 

 

  • Period slicer: Period Slicer

I’ve tried using DAX to detect the selected value from the Period slicer (e.g., with SELECTEDVALUE and ISFILTERED), but I can’t figure out how to apply that logic to dynamically hide or disable the Date slicer visual itself.

Is there a way to achieve this, either by conditional formatting, bookmarks, or another workaround?

 

Thanks a lot for any help or ideas!

 

Best regards,
Bojan

17 Replies

  • Hi BJankic 

    While it is possible to hide another visual witha  shape  by using conditional formatting, it won't be useful as you won't be able to interact with the visual underneath the shape at all. You may disable a slicer though. Create a measure to be used as a visual filter on the date slicer

    Toggle =
    IF ( SELECTEDVALUE ( Presets[DatesPreset] ) = "Custom", 1 )
    

     

     Set the visual filter on Toggle to "is not blank".

     

    • BJankic's avatar
      BJankic
      Icon for Helper II rankHelper II

      Hi danextian,

       

      Thank you! This is exactly what I need, but for some reason, it’s not working on my end.

       

      Here’s how I have it set up in the data model, should I change something? What did you do on your end?

       

       

  • kpost's avatar
    kpost
    Icon for Solution Sage rankSolution Sage

    conditionally displaying a visual based upon a selection in a slicer is not currently possible.

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI BJankic ,

     

    Create a measure which gives 1 when selected value of the slicer column is  Custom else gives 0. Then add this measure in filter pane of the date slicer. You can choose show items when value is - 1 in the filter as below.

     

     

    • BJankic's avatar
      BJankic
      Icon for Helper II rankHelper II

      Hi Anonymous ,

       

      Could you show me an example? I understand what you’re saying, but it’s not actually working — at least not on my end.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Sure. I have created a simple pbix implemeting this. First pic when I select custom. Second pic is when I select other options

         

         

    • BJankic's avatar
      BJankic
      Icon for Helper II rankHelper II

      Thank you, MasonMA ! I did check that video, but it doesn’t cover the single-select slicer option.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi BJankic ,

    I would also take a moment to thank danextian  , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
     

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions