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

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

Reply
Sunshine123
Frequent Visitor

How to set default on data slicer when open Power BI

Hi, 

I want to create a default on a slicer to the current week, when open Power BI. So it must be dynamic. 

Any suggestions?

Sunshine123_0-1646833097474.png

Many Thanks!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Sunshine123 ,

 

I'd like to suggest you to create a slicer table like below.

slicer = 
var _table = SELECTCOLUMNS(CALENDAR(DATE(2020,1,1),DATE(2022,12,31)),"week",YEAR([Date])&"_"&WEEKNUM([Date]))
var _thisweek = SELECTCOLUMNS(_table,"week","this_week")
return
distinct(UNION(_table,_thisweek))

1.jpg

Then create a measure like below:

measure =
VAR _weeknum =
SELECTEDVALUE ( 'table'[week] )
RETURN
IF (
SELECTEDVALUE ( 'slicer'[week] ) = "this_week",
IF ( _weeknum = WEEKNUM ( TODAY () ), 1, 0 ),
IF ( _weeknum = SELECTEDVALUE ( 'slicer'[week] ), 1, 0 )
)

Add this measure to visual filter set value = 1.

The visual will display value of the latest week when "this week" is selected.

 

Best Regards,

Jay

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Sunshine123 ,

 

I'd like to suggest you to create a slicer table like below.

slicer = 
var _table = SELECTCOLUMNS(CALENDAR(DATE(2020,1,1),DATE(2022,12,31)),"week",YEAR([Date])&"_"&WEEKNUM([Date]))
var _thisweek = SELECTCOLUMNS(_table,"week","this_week")
return
distinct(UNION(_table,_thisweek))

1.jpg

Then create a measure like below:

measure =
VAR _weeknum =
SELECTEDVALUE ( 'table'[week] )
RETURN
IF (
SELECTEDVALUE ( 'slicer'[week] ) = "this_week",
IF ( _weeknum = WEEKNUM ( TODAY () ), 1, 0 ),
IF ( _weeknum = SELECTEDVALUE ( 'slicer'[week] ), 1, 0 )
)

Add this measure to visual filter set value = 1.

The visual will display value of the latest week when "this week" is selected.

 

Best Regards,

Jay

amitchandak
Super User
Super User

@Sunshine123 , You have to use workaround. We do not have function support yet

 

have a column like this in table

 

Week Type =
var _st = today() +-1*WEEKDAY(today() ,2)+1
var _end = today() + 7-1*WEEKDAY(today(),2)
return
Switch( True(),
[Date] >= _st && [Date] <= _end ,"This Week" ,
[Date] >= _st-7 && [Date] <= _end -7,"Last Week" ,
[Week Name]
)

 

then save on this week

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks @amitchandak! It worked very well. 

How can set a default on "This Week" on the slicer now? Each time when a user will open the file I want "This Week"preselected. 

Many thanks in advance! 

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.