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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
owdtelly88
Frequent Visitor

3 Week Rolling Average By Day of Week

Hi All,

 

I'm trying to create a rolling average based on total hours worked.

 

I need to group it by each day of the week, cost code and by worker.

 

My hours are in a table along with activity date, worker id and cost code. Each line is an entry against a cost code and a worker might have one line per day or several if they've been working on multiple cost codes. 

 

A worker won't necessarily work every day so some may be blank. 

 

Thanks in advance for any help. 

 

Chris 

 

 

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @owdtelly88,

 

Try measure as:

Measure = 
CALCULATE(
    AVERAGEX(FILTER(ALL('Table'),WEEKDAY('Table'[Date])=WEEKDAY(MAX('Table'[Date]))),'Table'[Value]),
    DATESINPERIOD('Table'[Date],MAX('Table'[Date]),21,DAY)
)

Here is the output:

vxulinmstf_0-1628067393500.png

 

The pbix is attached, please try it.

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

View solution in original post

3 REPLIES 3
v-xulin-mstf
Community Support
Community Support

Hi @owdtelly88,

 

Try measure as:

Measure = 
CALCULATE(
    AVERAGEX(FILTER(ALL('Table'),WEEKDAY('Table'[Date])=WEEKDAY(MAX('Table'[Date]))),'Table'[Value]),
    DATESINPERIOD('Table'[Date],MAX('Table'[Date]),21,DAY)
)

Here is the output:

vxulinmstf_0-1628067393500.png

 

The pbix is attached, please try it.

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

amitchandak
Super User
Super User

@owdtelly88 , Based on what I understand

averageX(summarize(Table, [activity date], [worker id] , [cost code] , "_1", [Measure]),[_1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks for your reponse. How would I incorporate the above into a three week rolling average please? Also, just to clarify, when you mention measure, you mean sum of hours?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.