Forum Discussion

KL124's avatar
KL124
New Member
10 months ago
Solved

How to auto-reset “Custom” date range when switching back to predefined ranges

I’m building a dynamic date selection in Power BI with a standard Calendar table and a helper table for predefined ranges + a “Custom” option. Users can pick a predefined period (e.g., WTD, MTD, last...
  • WishAskedSooner's avatar
    10 months ago

    KL124,

     

    Hello,

     

    The easiest way to handle this is via Bookmarks. I will give a high level solution:

     

    1. Create the various time slicers that you will need e.g. Period (with WTD, MTD, etc) and Custom.

    2. Now, create a disconnected table with the entries that represent which Bookmark they have selected e.g. Period and Custom.

    3. Put #2 into its own slicer.

    4. Now, create Bookmarks that save the state of the slicer in #3 making sure to select Period when that Bookmark is selected and Custom when the other Bookmark is selected. Be sure to select that the Bookmark saves the Data and usually best only Selected Visuals. You should also hide the Slicer in #3.

    5. Finally, you will need to modify your measures to include a VAR _Sel = SELECTEDVALUE( _disconnectedStateTable[Selection] ) and use that in a IF or SWITCH.

     

    Warning! Working with Bookmarks is tricky which is why I avoid them unless absolutely necessary. You need to be very careful that you have everything correctly configured, filtered, selected, hidden, visible, etc. before saving or updating your Bookmark. Constant back and forth testing is advisable.

     

    Good luck!