Rolling 3 months sales

Dear all experts,

I would like to calculate the rolling last 3 months based on the month of each record and group looped by boutique, could anyone recommend how I can do it in KNIME? Please see below table, and the Rolling past 3 months is the column I would like to create in KNIME.

For example: 2018-12 should be the sum of 2018-12, 2018-11 and 2018-10.

And for the record which does not have previous 2 months record, it will show nothing.

Thanks a lot for your time, and I look forward to hearing from you. Appreciate it!

BTQ Year Month Sales Rolling past 3 months
A 2018 10 100
A 2018 11 200
A 2018 12 300 600
A 2019 1 400 900
A 2019 2 500 1200
A 2019 3 600 1500
A 2019 4 700 1800
B 2018 5 800
B 2018 6 900
B 2018 7 1000 2700
B 2018 8 1100 3000
B 2018 9 1200 3300
B 2018 10 1300 3600
B 2018 11 1400 3900
B 2018 12 1500 4200
B 2019 1 1600 4500
B 2019 2 1700 4800
B 2019 3 1800 5100
B 2019 4 1900 5400

Hi @ashwan15hk

See this wf moving average with group loop (22.3 KB) with a group loop for BTQ and a moving aggregation (window=3).

gr. Hans

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.