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
Anonymous
Not applicable

Rolling average for the last 4 weeks average value.

Hi All,

 

Need your support.

I want to calculate moving/rolling average value of a KPI for the last 4 weeks average values using DAX.

I have simply calculated the values in excel for the reference and attached the Snapshot as well.

Please consider the values and help to get the desired ouput.

 

Rolling Average.png

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You'll need a week commencing column on your date table, or something similar, then 

Weekly Avg = 
VAR currentWC =
    MAX ( 'Date'[W / C] )
VAR startDate = currentWC - 35
VAR endDate = currentWC - 1
RETURN
    AVERAGEX (
        ADDCOLUMNS (
            CALCULATETABLE (
                SUMMARIZE ( 'Date', 'Date'[W / C] ),
                DATESBETWEEN ( 'Date'[Date], startDate, endDate )
            ),
            "@val", [Measure]
        ),
        [@val]
    )

View solution in original post

1 REPLY 1
johnt75
Super User
Super User

You'll need a week commencing column on your date table, or something similar, then 

Weekly Avg = 
VAR currentWC =
    MAX ( 'Date'[W / C] )
VAR startDate = currentWC - 35
VAR endDate = currentWC - 1
RETURN
    AVERAGEX (
        ADDCOLUMNS (
            CALCULATETABLE (
                SUMMARIZE ( 'Date', 'Date'[W / C] ),
                DATESBETWEEN ( 'Date'[Date], startDate, endDate )
            ),
            "@val", [Measure]
        ),
        [@val]
    )

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.