Disabling "in between" date slicers in Power BI using DAX

543 Views Asked by At

I have two date filter options used in Power BI report. One is pre-defined periods such as current month, current year and so on. Another option is to filter by custom date using an in between date slicer. But for it to work, The date slicer should be disabled when a predefined period is selected. I have the DAX applied in the filter visual but it seems like the "to/last date" date does not get disabled, only the "from/start date".

DAX: Date Slicer Filter = IF( SELECTEDVALUE(cSpecialDates[Period]) = "Custom Date", 1, 0 )

enter image description here

I would like to avoid using bookmarks as a solution.

1

There are 1 best solutions below

0
user21718457 On

Have this same scenario. While there is no "implicit" clearing of the selected custom date when you change date periods, one workaround is to display a message in the header to prompt the user to "clear" slicer selections when switching to a different period range.

  1. Create a measure as:
    Date Slicer Title = 
             IF ('Date Periods'[Date Slicer Filter]=1, 
                 "Choose custom date range", 
                 "Custom range disabled, clear selections!")
    
  2. Use this in the conditional formatting for the custom slicer's header.
  3. You can take a step further by formatting color for the prompt.