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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
shilpa123
Frequent Visitor

Wants to set default current week and previous week in slicer

Hi 

I have a requirement like by default in slicer it should select current week and previous week in the slicer  can any one please help me out with this requirement.

 

 

Thanks

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @shilpa123,

The current slicer does not support setting default values, you can create a calculated column to check row values based on current DateTime and return flags.

After these steps, you can manually select the flags and save them to bookmark, then you can bind this bookmark to the button action and use it to reset the default selection. (notice: this calculate column will be dynamic change based on current system DateTime)

Create report bookmarks in Power BI to share insights and build stories - Power BI | Microsoft Docs
Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
havitechnology
New Member

To set a default selection in a Power BI slicer to current week and previous week, you'll need to use a combination of calculated columns, DAX measures, and potentially a custom table to drive slicer behavior. Unfortunately, Power BI slicers do not support default selections natively without user interaction, but you can work around this by creating a calculated column or flag for filtering visuals or syncing slicers.

 

Here's a step-by-step approach:

 

Step 1: Create a Date Table (if not already available)

 

Make sure you have a proper Date table with continuous dates.

DateTable =
ADDCOLUMNS (
CALENDAR (DATE(2022,1,1), DATE(2030,12,31)), -- Adjust range as needed
"Year", YEAR([Date]),
"Week Number", WEEKNUM([Date], 2), -- 2 = week starts on Monday
"Year-Week", YEAR([Date]) * 100 + WEEKNUM([Date], 2)
)

 

Step 2: Add a Flag Column for Current and Previous Week

 

WeekFlag =
VAR CurrentYear = YEAR(TODAY())
VAR CurrentWeek = WEEKNUM(TODAY(), 2)
VAR DateYear = YEAR('DateTable'[Date])
VAR DateWeek = WEEKNUM('DateTable'[Date], 2)
RETURN
IF (
(DateYear = CurrentYear && DateWeek = CurrentWeek) ||
(DateYear = CurrentYear && DateWeek = CurrentWeek - 1),
"Current/Previous Week",
"Other"
)

 

Step 3: Use the Flag in a Slicer

 

  • Add the WeekFlag column as a slicer.

  • Set it to single-select OFF and multi-select ON.

  • Use bookmarks to pre-select the slicer state (optional workaround).

 

Optional Visual Filter Approach (Without Slicer Selection)

 

If the slicer is just to filter visuals, you can use a visual-level filter or DAX measure like:

 

IsCurrentOrPreviousWeek =
VAR CurrentYearWeek = YEAR(TODAY()) * 100 + WEEKNUM(TODAY(), 2)
VAR PrevYearWeek = CurrentYearWeek - 1
RETURN
IF (
'DateTable'[Year-Week] = CurrentYearWeek ||
'DateTable'[Year-Week] = PrevYearWeek,
1, 0
)

 

Then apply this as a visual-level filter where IsCurrentOrPreviousWeek = 1.

 

What are the best ways to mitigate implementation risks?

 

The best way to mitigate implementation risks is to use phased rollouts, engage a certified Microsoft partner like Havi Technology, invest in comprehensive user training, follow a structured data migration plan, and maintain strong change management.

  • Phased Rollouts: Staging your deployment in incremental steps reduces risk, allows for feedback, and keeps the business stable.
  • Local Microsoft Partner Engagement: Engaging a Microsoft-certified partner ensures your rollout meets Australian compliance needs and follows industry best practices.
  • Comprehensive User Training & Ongoing Support: Investing in tailored, ongoing training empowers staff, builds confidence, and maximises system utilisation.
  • Structured Data Migration: A carefully managed migration plan - including pilots, validation, and governance - ensures data integrity and business continuity.
  • Proactive Change Management: Open communication, visible leadership support, and clear articulation of system benefits foster organisational buy-in and a smooth transition.
Anonymous
Not applicable

HI @shilpa123,

The current slicer does not support setting default values, you can create a calculated column to check row values based on current DateTime and return flags.

After these steps, you can manually select the flags and save them to bookmark, then you can bind this bookmark to the button action and use it to reset the default selection. (notice: this calculate column will be dynamic change based on current system DateTime)

Create report bookmarks in Power BI to share insights and build stories - Power BI | Microsoft Docs
Regards,

Xiaoxin Sheng

kapinal
Regular Visitor

Hi, If you have any requirement like by default in slicer. you can contact Dynamics Square. Dynamics Square is a Microsoft Partner. You can contact directly

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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