cancel
Showing results for
Did you mean:
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
Super User IV

@jsflint

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

Proud to be a Super User!

3 REPLIES 3
Super User III

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

Frequent Visitor

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?

Super User IV

@jsflint

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

Proud to be a Super User!

Announcements