Forum Discussion
How to auto-reset “Custom” date range when switching back to predefined ranges
- 10 months ago
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!
Hello,
I think a bookmarks solution like WishAskedSooner is definitely the cleanest way of handling this but an alternative approach which is alot easier and quicker to implement, would be to make 2 fields for slicing instead and just having a button to clear filters.
e.g. Someone puts in a custom date into the date slicer. Then they want to use a predefined range from the other options. They click on the button to reset the range and then go to the second slicer to select a predefined date range.
You'd have to maybe inform your users of how it works and would probably be useful to add help tooltips but this would be the easiest way.