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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Sravanthi_B
Frequent Visitor

Latest Week Slicer update

Hi,

I have a week slicer, that is intended to display the latest 8 weeks with ranges like 4 Jul - 20 Jul 2025, 07 Jul - 13 Jul 2025 as shown below. When the latest week's data (e.g., 14 Jul - 20 Jul 2025) is added, the slicer in Power BI Desktop does not automatically select the latest week range. The data type and format of the week field is Text .

Currently, we are handling this manually by updating bookmarks.

 

Sravanthi_B_0-1753109005402.png

 

Solutions tried out:-

 

IsLatestWeek = IF([Week Range] = MAX('Week'[Week Range]), 1, 0)

 

Start of Week1 = 'Raw Dataset'[Time Stamp - Copy] - WEEKDAY('Raw Dataset'[Time Stamp - Copy],2) +1

 

Thanks in advance.

2 ACCEPTED SOLUTIONS
danextian
Super User
Super User

Hi @Sravanthi_B 

 

Your week range column seems to be sorted correctly so I would use the custom column sort to filter the slicer. 

Below is a sample calculated column to determine whether a week ending date is in the last 8 weeks ending dates

Last 8 Weeks = 
Dates[Week Ending Sunday]
    IN TOPN (
        8,
        VALUES ( Dates[Week Ending Sunday] ),
        Dates[Week Ending Sunday], DESC
    )

 

danextian_0-1753179675633.png

Use the calculated column as a visual filter

danextian_1-1753179741452.png

 

As to the selection to default to the last week, you can leverage the Group by Columns property to "store a filter by using an alternate value, which represents the key of the entity." Power BI uses this key to store the filter, allowing the corresponding filter value in the visual to change dynamically. For instance, if May-24 is selected in the visual and currently has a key of 0, when June arrives, May will shift to a key of 1, and June will take the key of 0. Consequently, the slicer selection will automatically change to June. This property can be accessed using an external tool called Tabular Editor. Demo and further reference can be found here -  https://youtu.be/MrEAZREQuXM 

 

In my example, I used RANKX to create an offset column.

danextian_2-1753180199879.png

Please refer to the attached pbix

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

v-venuppu
Community Support
Community Support

Hi @Sravanthi_B ,

Thank you for reaching out to Microsoft Fabric Community.

Thank you @burakkaragoz @danextian for the prompt response.

You can show only the latest 8 weeks in your slicer by ranking weeks using their end date. To make sure it updates as new data comes in, use a dynamic filter based on that ranking. Power BI doesn’t let slicers auto-select a value by default, but with a tool like Tabular Editor, you can mark the latest week to be pre-selected. This way, the slicer stays current and highlights the latest week without manual updates.

Thank you.

View solution in original post

10 REPLIES 10
v-venuppu
Community Support
Community Support

Hi @Sravanthi_B ,

I hope the information provided is helpful.I wanted to check whether you were able to resolve the issue with the provided solutions.Please let us know if you need any further assistance.

Thank you.

Hi @v-venuppu,

We’ve informed the Business about the Power BI slicer limitation and are waiting for their confirmation to update the requirement to the latest week.

v-venuppu
Community Support
Community Support

Hi @Sravanthi_B ,

May I ask if you have resolved this issue? Please let us know if you have any further issues, we are happy to help.

Thank you.

v-venuppu
Community Support
Community Support

Hi @Sravanthi_B ,

I wanted to check if you had the opportunity to review the information provided and resolve the issue..?Please let us know if you need any further assistance.We are happy to help.

Thank you.

v-venuppu
Community Support
Community Support

Hi @Sravanthi_B ,

Thank you for reaching out to Microsoft Fabric Community.

Thank you @burakkaragoz @danextian for the prompt response.

You can show only the latest 8 weeks in your slicer by ranking weeks using their end date. To make sure it updates as new data comes in, use a dynamic filter based on that ranking. Power BI doesn’t let slicers auto-select a value by default, but with a tool like Tabular Editor, you can mark the latest week to be pre-selected. This way, the slicer stays current and highlights the latest week without manual updates.

Thank you.

danextian
Super User
Super User

Hi @Sravanthi_B 

 

Your week range column seems to be sorted correctly so I would use the custom column sort to filter the slicer. 

Below is a sample calculated column to determine whether a week ending date is in the last 8 weeks ending dates

Last 8 Weeks = 
Dates[Week Ending Sunday]
    IN TOPN (
        8,
        VALUES ( Dates[Week Ending Sunday] ),
        Dates[Week Ending Sunday], DESC
    )

 

danextian_0-1753179675633.png

Use the calculated column as a visual filter

danextian_1-1753179741452.png

 

As to the selection to default to the last week, you can leverage the Group by Columns property to "store a filter by using an alternate value, which represents the key of the entity." Power BI uses this key to store the filter, allowing the corresponding filter value in the visual to change dynamically. For instance, if May-24 is selected in the visual and currently has a key of 0, when June arrives, May will shift to a key of 1, and June will take the key of 0. Consequently, the slicer selection will automatically change to June. This property can be accessed using an external tool called Tabular Editor. Demo and further reference can be found here -  https://youtu.be/MrEAZREQuXM 

 

In my example, I used RANKX to create an offset column.

danextian_2-1753180199879.png

Please refer to the attached pbix

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi,

@danextian Thanks for your help.
I tried the solution you provided, and it works the first time. However, when new data is added, it doesn't pick up the latest date.
Thanks in advance.

Sravanthi_B
Frequent Visitor

Hi @burakkaragoz ,

Thanks for the help. However, the issue is that the DAX provided displays only the latest week.

What we need is to display the last 8 weeks, including the latest week, in the week slicer and the default selection should be the latest week.

 

Thanks in advance.

 

 

Ah got it, I misunderstood your requirement! You want the slicer to show the last 8 weeks but have the latest week selected by default.

Here's what you need to do:

Step 1: Filter your Week table to show last 8 weeks Create a calculated column or use a filter:

Show in Slicer = 
VAR LatestWeekEnd = 
    MAXX(
        'Week',
        DATEVALUE(RIGHT(SUBSTITUTE('Week'[Week Range], " - ", REPT(" ", 50)), 11))
    )
VAR CurrentWeekEnd = 
    DATEVALUE(RIGHT(SUBSTITUTE([Week Range], " - ", REPT(" ", 50)), 11))
VAR WeeksDiff = (LatestWeekEnd - CurrentWeekEnd) / 7

RETURN IF(WeeksDiff <= 7, 1, 0)

Step 2: Filter your slicer Add this column to your slicer's filter and show only where "Show in Slicer" = 1.

Step 3: Set default selection Unfortunately, Power BI doesn't have built-in "default selection" for slicers. You have a few options:

  • Use bookmarks to save the latest week selection
  • Create the report with the latest week pre-selected and save it that way
  • Use Power BI Service's "persistent filters" feature

The slicer will now show 8 weeks, and you can set up bookmarks to automatically select the latest one when the report loads.

burakkaragoz
Community Champion
Community Champion

Hi @Sravanthi_B ,


Your week field is text, so when you use MAX() it's doing alphabetical sorting instead of actual date sorting. That's why it's not picking up the latest week properly.

The issue is "07 Jul - 13 Jul 2025" comes before "14 Jul - 20 Jul 2025" alphabetically, but obviously that's not the newest week.

Quick fix: You need to extract the actual end date from your text and use that for comparison. Try this:

IsLatestWeek = 
VAR EndDateFromText = DATEVALUE(RIGHT(SUBSTITUTE([Week Range], " - ", REPT(" ", 50)), 11))
VAR ActualMaxDate = MAXX('Week', DATEVALUE(RIGHT(SUBSTITUTE('Week'[Week Range], " - ", REPT(" ", 50)), 11)))
RETURN IF(EndDateFromText = ActualMaxDate, 1, 0)

This pulls out the end date from your text string and compares actual dates instead of text.

Better long-term solution: Add a proper date column to your data that represents the week end date. Then you can do normal date comparisons without all this text parsing nonsense.

Alternative: If you control the data source, format your week ranges like "2025-07-13 to 2025-07-19" so they sort properly as text. But the date extraction approach above should work with your current format.

The main thing is getting away from text comparisons for dates. Text just doesn't work for chronological sorting.


If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.

This response was assisted by AI for translation and formatting purposes.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.