Forum Discussion

Sravanthi_B's avatar
Sravanthi_B
Frequent Visitor
1 year ago
Solved

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...
  • danextian's avatar
    1 year ago

    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

     

     

  • v-venuppu's avatar
    1 year ago

    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.