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
davehus
Memorable Member
Memorable Member

Rolling 28 Days Measure

Hi, I'm having an problem with a measure. I want to get a rolling 28 days downtime from a production table. There is a filter on the page which is Year Week Slicer. This defaults to 'Prior Week' on opening the report and the user can selected a week number as normal in the format 202412 as required. I need the user to see a rolling 28 day downtime in a weekly bar based on their selection, however when I try to remove the Year Week Slicer it doesn't work and just displays the previous weeks data and nothing more. My dax code is as follows: 

 

Rolling 4 Week Downtime =
CALCULATE (
    SUM ( 'Downtime Table'[Downtime] ),
    FILTER (
        ALL ('Downtime Table'[ProductionDate] ),
        'Downtime Table'[ProductionDate]
            >= SELECTEDVALUE ( 'Downtime Table'[ProductionDate] ) - 28
    ),REMOVEFILTERS('Date Table'[Week Slicer])
)
 
Any help would be appreciated.
3 REPLIES 3
Anonymous
Not applicable

Hi, @davehus 

Have you solved your problem? If so, can you share your solution here and mark the correct answer as a standard answer to help other members find it faster? Thank you very much for your kind cooperation!

 

Best Regards

Yongkang Hua

dharmendars007
Super User
Super User

Hello @davehus , 

 

Please us the below modified DAX..

Rolling 4 Week Downtime =
CALCULATE (
SUM ( 'Downtime Table'[Downtime] ),
FILTER (
ALL ( 'Downtime Table'[ProductionDate] ),
'Downtime Table'[ProductionDate] >=MAX ( 'Downtime Table'[ProductionDate] ) - 28 &&
'Downtime Table'[ProductionDate] <=MAX ( 'Downtime Table'[ProductionDate] )),
REMOVEFILTERS('Date Table'[Week Slicer]))

1. MAX instead of SELECTEDVALUE: This ensures the rolling window is calculated based on the most recent production date, regardless of slicer filters.

2. Range Filter: I’ve added a <= MAX() condition to ensure that only the dates within the last 28 days are summed.

3. Filter on All Production Dates: ALL removes existing filters on the date column to correctly apply the rolling logic.

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes 👍 are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 



 

Hi @dharmendars007 , 

 

This didn't work I'm afraid. I've tried similiar dax code to the one you've supplied. It still is filtered to the week slicer when implemented. 

davehus_0-1730276442941.png

 

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.