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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anil_katta
Frequent Visitor

Selecting default - week value dynamically

Hello,

 

Have a week slicer and need to select the week value automatically when the last week changes to current week and current week changed to next week - dynamically.

The week slicer has to pick the current week by default and it has to change dynamically when we move to next week.

for example - The week start from Sunday - saturday(30-07-2023 To 05-08-2023) slicer has to pick this week as default and this week has to be selected/checked automatically.

If calendar moves to next week i,e. (06-08-2023 To 12-08-2023) - then week slicer have to changed to this week automatically.

 

Any advices/ideas how can achieve this scenario in Power BI

 

Thanks in advance.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anil_katta ,

 

Here are the steps you can follow:

1. Then we find the "Preselected Slicer" and add the visual to our Power Bi Desktop.

vyangliumsft_0-1690877622862.png

2. First , we need to create a table with one column , and the value is True and False,.

vyangliumsft_1-1690877622864.png

3. Second , we can create a measure to define which the date we need to default preselected. If we need to default preselect then we return True else return False.

Flag =
var _date =SELECTEDVALUE('Table'[WEEK])
return
IF(_date = WEEKNUM(TODAY(),2) , TRUE(),FALSE())

4. Then we can put the 'Table'[Date] in the Fields , [Flag] in the Pre Selection , 'Dirty Table'[Dirty Status] in the Dirty Status, like below screenshot:

vyangliumsft_2-1690877649819.png

5. Result:

vyangliumsft_3-1690877649823.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @Anil_katta ,

 

Here are the steps you can follow:

1. Then we find the "Preselected Slicer" and add the visual to our Power Bi Desktop.

vyangliumsft_0-1690877622862.png

2. First , we need to create a table with one column , and the value is True and False,.

vyangliumsft_1-1690877622864.png

3. Second , we can create a measure to define which the date we need to default preselected. If we need to default preselect then we return True else return False.

Flag =
var _date =SELECTEDVALUE('Table'[WEEK])
return
IF(_date = WEEKNUM(TODAY(),2) , TRUE(),FALSE())

4. Then we can put the 'Table'[Date] in the Fields , [Flag] in the Pre Selection , 'Dirty Table'[Dirty Status] in the Dirty Status, like below screenshot:

vyangliumsft_2-1690877649819.png

5. Result:

vyangliumsft_3-1690877649823.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

amitchandak
Super User
Super User

@Anil_katta , You have to create this column in date tbale and save on this week or last week

 

 

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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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