Forum Discussion

13havya's avatar
13havya
Frequent Visitor
2 years ago

How to dynamically select options from a filter/slicer?

Hi,

 

Is there a way to dynamically select options from a slicer, without applying a filter on it? 

For instance, some of my reports have a calendar month dropdown slicer. I also have a month offset field in the calendar table. 

Is there some way I can use the month offset filter to default the calendar month slicer selection to the current month, but allow the users to view all the previous months, so they can select the ones they would like to analyse. At present, for filters like this, the selection needs to be updated every month.

1 Reply

  • Hi 13havya 

     

    I cover a few options in my blog post here, which you may want to take a look at (which you might have already done! 🙂 

     

    A problem, however, is that the methods I suggest don't work perfectly with drop-down slicers. This is because the "caption" of a drop-down slicer (i.e value displayed on the slicer) is hard-coded in the Power BI report file. It is not updated automatically even if the underlying filter changes, until a report viewer interacts with the slicer in some way. So the filter may in fact update from August to September, but the slicer will still show August until it is clicked on.

     

    If you are happy to use a vertical list or Button slicer rather than a drop-down slicer, then either of these solutions may be suitable:

    • Solution 2 : Set Calendar Month column's Group By Columns property to Month Offset
    • Solution 3: Button slicer with a measure value displayed

     

    If you really need drop-down, the best solution I know of is:

    • Solution 5: Use the Preselected Slicer custom visual with a boolean measure that returns true for the month with Month Offset = 0.

     

    Does any of that help?

     

    Regards