Moving calculations

Hello everyone,

I’ve got a table with date and number of sells, for each day I need to calculate the average of sells in the last “x” days.

For example:

Sells Avg last 3 day
01/04/2022 2 2,00
02/04/2022 4 3,00
03/04/2022 9 5,00
04/04/2022 2 5,00
05/04/2022 10 7,00
06/04/2022 3 5,00
07/04/2022 2 5,00

(the first two rows can’t use 3 days, so they have to use 1 and 2 days)

How can I do this?

You need a rolling sum divided by 4 (the number of days).

See this topic on how to get a rolling sum: How to calculate a rolling aggregate

Nice trick!
Thank you very much.

To learn more about EasyMorph visit easymorph.com.