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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Brian415_
Frequent Visitor

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!

8 REPLIES 8
ribisht17
Super User
Super User

I have created this video on my You tube channel

 

https://youtu.be/si7r1MQ0YCA

 

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

Jonvoge
Solution Supplier
Solution Supplier

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

uc516
Frequent Visitor

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 😄

@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? 

Sorry I saw your message late 🙂


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

@ribisht17 Thanks, but this doesnt work. Your first link for example; will limit the slicer behaviour to only the current week. I want that the date slicer is automatically set by DEFAULT current week. If the user wants to change it to another date, he should be able to trough adjustment. With this solution you are only able to see current week to my understanding. 

Edit: Just realised that you were replying to someone else's comment not to mine, my bad there. Regadless i'll leave it in case it helps clarify my other suggestion.

 

Yes the default will be showing current week only, it worked in my case as i used the drop down selection of the week numers as a whole unit.

As below: 

uc516_0-1710595541904.png

 

 

I couldn't find any other way to show by default a limited range unfortunately. It should definietly be a built in feature, would save a lot on unecessary hustle.

 

In your case, maybe you could make a sinlge tile slicer, where you'd put a calc column that lables the current weeks values as "click here to expand data" and blank for the other values.

So when the user clicks on it, it basically deselects the current week filtering and expands the data to the whole range

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.