Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Sean1246
New Member

Date range slicer rolling default

Hi there,

 

I have a between date range slicer.

PBIDesktop_lHDFE0VDi6.png

 

 

 

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] <= _Today

However, 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:
PBIDesktop_XSONWQ6D5C.png

 

 

 

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 1
lbendlin
Super User
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.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors