Forum Discussion
Urgent Help: Set Date Slicer by Default to Current Week
Hello,
I've been grappling with a bit of a challenge in Power BI, specifically regarding date filtering, and I was hoping to get some advice.
Here's the scenario: I've set up a "Date" table in Power BI that spans from January 1, 2000, to January 1, 2030. Now, what I'm aiming for is to have a date slicer or filter on my dashboard that automatically defaults to the current week, meaning from the first day of the week through the last. For instance, today is March 15, 2024, so ideally, the slicer should default to March 11, 2024, through March 17, 2024.
However, here's the kicker: I also want users to have the flexibility to select dates outside of the current week if they need to analyze data over a longer period. So while the default setting should always be the current week, users should be able to freely adjust the slicer to their desired timeframe.
I've been tinkering around with Power BI, but it seems like achieving this functionality isn't as straightforward as I initially thought. It feels like Power BI might not be as intuitive in this particular area.
If anyone has any tips or suggestions on the easiest way to tackle this issue, I'd greatly appreciate it. Thanks in advance for any help you can provide!
9 Replies
- Jonvoge
Most Valuable Professional
Hi Brian415
This is a notoriously difficult requirement to deal with.
While it it possible to set a report to default to the range you are suggesting amd still allow some pre-defined flexibility (e.g. by using the method discussed here: Dynamic Date Range Slicer- Query M - Power Query / M Code Showcase - Enterprise DNA Forum), I have not found a good way to keep both Start and End og the period completely dynamic to the user.
My suggestion would be to use the above approach for your default page, and have a secondary page with a Between Slicer that they can adjust themselves (or perhaps a button to toggle between two bookmarks, instead of two pages).
_____________________________________________________
I hope my comment was helpful.
If your question was answered, please mark your post as 'Solved' and consider giving me a 'Thumbs Up'.
Find me on LinkedIn, Sessionize, or my blog Downhill Data- Brian415_Frequent Visitor
Jonvoge Thanks for the quick response! Strange that a simple functionality like this is not possible. I am hoping someone maybe has a clue how you can achieve this easier. I almost refuse to believe there is no way to achieve this. Hopefully someone can help.
AmiraBedh amitchandak Any clue maybe?
- AmiraBedh
Super User
Sorry I saw your message late 🙂
- AnonymousNot applicable
Hi both,
(Thought I'd answer here so both get a notification).
The way I solved this issue was with a calcuated column and a drop down menu.
The formula basically checks if the week value of the dates column matches the week value of today(), if yes label it "Current week", else put in the number of the week (alternatively use "Week " & [number]), then in the dropdown using this calculated column, you'll have "Current week" selectable.
Have it selected when saved and published.
That way the default will always be with only the current week filtering selected, but users will also be able to expand their search if needed.
It's not ideal that it shows current week, instead of the actual number, but you can write some simlple Measures, that display the week or date in a card.
Hope that helps.
Note: if the week number is added to the Current Week label (eg Current Week 5), the application will fail the following week as it will fail to find the selected "Current Week 5", don't make the mistake I made 😄
- ribisht17
Super User
I have created this video on my You tube channel
Regards,
Ritesh
Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !! PL 300 Certification Series- zdychoFrequent Visitor
Watched the video but wondering whether it is possible to set the slicer to align itself from week to week. When I implemented it replicating your steps in the video, once a new week starts the old remains selected and therefore I need to manually update the slicer.. Ideally, this would happen automatically.. Does anyone have a fix for that?