Forum Discussion
Date range slicer rolling default
Hi there,
I have a between date range slicer.
The slicer has a filter applied that sets the start date of the slicer and the end date of the slicer to roll over each year. The code behind the filter is:
Current Range =
VAR _Today = TODAY()
VAR _Year = IF ( MONTH ( _Today ) < 8, YEAR ( _Today ) - 1, YEAR ( _Today ) )
VAR _Start = DATE ( _Year, 8, 1 )
RETURN [Date] >= _Start && [Date] <= _TodayHowever, I want to now be able to see the previous years date by defaulting the slicer to the filter but with the option to drag the slicer back in time and having the default roll over each year. I can achieve viewing the historic data by setting the _Start variable to (2022, 8, 1) but I still need a way for the default filter to be applied when the report is first opened (this need to dynamically rollover each year).
For example:
My slicer should look like this when I first open the report, then once 01/08/2024 comes the default filter would move to 01/08/2024 with the ability to scroll back to 2023 and 2022.
Is this possible?
1 Reply
- lbendlin
Super User
You cannot programmatically set the selected values of a visual. Use the filter pane with relative date filters instead and allow users to change filters.