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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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.
Solutions tried out:-
IsLatestWeek = IF([Week Range] = MAX('Week'[Week Range]), 1, 0)
Thanks in advance.
Solved! Go to Solution.
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
)
Use the calculated column as a visual filter
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.
Please refer to the attached pbix
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.
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.
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.
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.
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.
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
)
Use the calculated column as a visual filter
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.
Please refer to the attached pbix
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.
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:
The slicer will now show 8 weeks, and you can set up bookmarks to automatically select the latest one when the report loads.
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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 43 | |
| 42 | |
| 23 | |
| 17 |
| User | Count |
|---|---|
| 190 | |
| 122 | |
| 96 | |
| 66 | |
| 47 |