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
jsflint
Frequent Visitor

Moving Average in Power Query M

How do you create a moving, or rolling, average in Power Query?  I already know how to do this in DAX, Excel, and Power BI, but I need to know how in Power Query.  Mainly because I need to use the resulting column in with other calculations.  

How could I do this on the example columns below?  I have a date column and random values in the second.  What would a 7 day moving average formula look like in Power Query M?

 

Thank you!

 

Date Value
1/1/2021 0.888073856
1/2/2021 0.087243733
1/3/2021 0.597531606
1/4/2021 0.25492501
1/5/2021 0.836644673
1/6/2021 0.253785258
1/7/2021 0.757333787
1/8/2021 0.958886707
1/9/2021 0.598108137
1/10/2021 0.180565909
1/11/2021 0.788755716
1/12/2021 0.888126908
1/13/2021 0.231740519
1/14/2021 0.107410191
1/15/2021 0.648458581
1/16/2021 0.582213204
1/17/2021 0.191300599
1/18/2021 0.864502562
1/19/2021 0.583108477

1 ACCEPTED SOLUTION

5 REPLIES 5
Anonymous
Not applicable

't really understand what's going on in that example for the Rolling Average, hard to understand

CNENFRNL
Community Champion
Community Champion

M is, no doubt, capable of processing data this way but is not inherently designated for such things.

Screenshot 2021-06-11 211303.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Ok thanks.  Now a follow up question.  Is it possible to build an exponential moving average, of the same duration, off the simple moving average?

@jsflint 

This question was answered over here: 
https://community.powerbi.com/t5/Power-Query/Exponential-Moving-Average-in-Power-Query-M/m-p/1897358...


Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Ok, but what if I want to reset the average every month..??

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.