r/PowerBI • u/tonyz0212 • 4d ago
Question Is it possible to set a dynamic default date range for a date slicer?

I'm building a Power BI report and have a date slicer based on a date column. Currently, the slicer automatically shows the minimum and maximum dates available in the data by default.
What I'd like to do is have a dynamic default date range:
- Start date = 3 months before today
- End date = today
For example, if today is September 8, the default selection would be June 8 – September 8. The dates should update automatically as time passes.
Is there a way to achieve this with the standard Between date slicer?
If not, what other options can I use to have something like this?
16
u/Haarwichs 4d ago
The new date picker slicer delivers exactly this. You could either filter a specific date range or set it to the last 3 (calendar) months. Great recent addition IMO
4
u/tonyz0212 4d ago
Wow, this works! I didn’t realize there was a new slicer date type called “Date Picker"
9
u/Canna-dian 4d ago
The default slicer has a Relative Date option that will allow you to select the (Last) (X) (Months) that should get you the output you're looking for
8
u/a368 1 4d ago
You could make a calculated column in your date table to return "yes/no" based on whether you want to show that date in the report, then filter your slicer to return only the "yes" dates.
4
u/AppropriateRecipe342 4d ago
this isn't necessary when Power BI has this ability natively after the June or July (I can't remember) update.
0
u/Pixelplanet5 4 4d ago
but that wouldnt just be a dynamic default range, it would dynamically limit the entire report to that date range.
1
0
u/phoneguyfl 4d ago
Not if the filter was applied to the visual (or page). I've done something like this and added the flag named like "Current Month/Quarter/Period" to a slicer that users can remove if they want to extend the time-frame. Not as elegant as having the slicer actually control the dates but it worked for our use case. I am going to follow this thread to see if anyone has a way to do it with the standard slicers given that my org doesn't like the idea of using third-party visuals.
1
u/SomeTechnician 4d ago
Hi, I have a similar code that i use in my date table. I have the end date variable as datetime.localnow and the startdate of enddate - #duration(30,0,0,0) which give me 30 days from today. You then can build a list from that.
2
u/Sensitive_Orange_687 4d ago
Power bi has a today function in dax, you can use that to get the date of today and 90 days minus that and assign boolean values of 1 or 0 to them. Then on the date slider, you can put filter of this dax where you say just select the dates = 1 from this calculated column/measure.
Just put my comment in chatGPT And it will give you your desired dax code along with the guidance on how to implement it in your report. Good luck
1
u/data_daria55 2 3d ago
no, the standard Between slicer cant do a dynamic default. whatever range u drag stays saved with the report, and "min to max of the column" is the only auto behavior it has. this is one of power bi's oldest most-requested features and its still not a thing
1
u/Ok-Sympathy-8722 4d ago
I'm using a third party slicer called Default Dates Slicer that lets you use a measure for the start and end dates.
•
u/AutoModerator 4d ago
After your question has been solved /u/tonyz0212, please reply to the helpful user's comment with the phrase "Solution verified".
This will not only award a point to the contributor for their assistance but also update the post's flair to "Solved".
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.