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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Steve_Scotland
Frequent Visitor

How to have dynamic slicer default / first option on opening a visual / dashboard

Hello

 

Last I can see this being asked for is 2018.  Wondering if umpteen updates later it is possible

 

Short version is I have a  DATES  table with Trans_Date, Week and Week_Int,  the latter being an Integer version of Week (Long story)

It is not considered to be a PowerBi date table or date hierarchy


My other table is Transactions with various data including Trans_Date with appropriate relationships

I have a measure

Week_Number_Yesterday  =

VAR Yesterday = TODAY() - 1
VAR WeekNumber =
    CALCULATE(
        MAX(DATES[Week_Int]),
        DATES[Trans_Date] = Yesterday
    )
RETURN WeekNumber

There is a slicer with the Week_Int   containing   1 to 52 -  which does its stuff quite fine

Now the user wants  the opening to be sliced by whatever current week we are in, so today  we are week 33.  Next week on refresh they would want it to open sliced to Week 34  but still  showing the other weeks in the slicer giving them the option to choose Week 22 were they to want to.

I told them to "go away", but it did get me wondering if such a thing was possible either on the original slicer or slicer (new)

As always, thanks in advance




2 REPLIES 2
Steve_Scotland
Frequent Visitor

@vicky_

Firstly, apologies for not responding quicker. I didn't get a notification of response.
I had 1 two minutes ago,  an anniversary alert

Had a quick play with your solution:  it has created this week from Sunday 18th to Saturday 24th rather than Monday 19th to Sunday 25th. Will have to work out why, I am almost certain our calendar runs Monday to Sunday
Further, it has put "this week" in all corresponding years going right back in the calendar which made me laugh

Thanks and apologies again









vicky_
Super User
Super User

There is a method, but it requires some small tweaks to your Date Table.

Date Table = ADDCOLUMNS(
    CALENDARAUTO(),
    "Week", 
        var thisWeek = WEEKNUM(TODAY())
        RETURN IF(WEEKNUM([Date]) = thisWeek, "This Week", FORMAT([Date], "yyyy") & " Week " & WEEKNUM([Date]))
)

Above is the DAX i used to create a date table - it's basically just your table, but i have a special value that is dynamically updated for the current week. I will then use the new "Week" column I created in a regular slicer, and set the default value of the slicer to "This Week". When the next week rolls around (plus minus a few hours for Time Zone differences), the value in the slicer should still be set to "This Week", but the dates that it is pointing to should update accordingly, and you still have the option to select other weeks in your slicer. 

Some things to consider:

I didn't do a sort column for my calculated Week column, but you can easily add one in.
You can't use a slider for text types, so your users will need to use a drop-down / list to select their week of interest

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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