Greetings all I am trying to calculate a weighted moving aggregate but the only other forum thread that is related to this had no detailed info from the inquirer’s side.

I have taken a look on the workflow by @aworker on that thread. I would like to start fresh with all the details for my case that are not present in the workflow:

Suppose I have datapoints like in Column A shown here:

Now, I am looking to get Column B. Column C is simply there to show the formula needed to get the values shown in Column B.

As you can see in Column C, the weights need to be reset or recount for each succeeding row. The examples use a lookback period of 3, hence why the first two rows are mostly empty and calculations should start from Row 3 onwards.

For this case, since the lookback period is 3, then the weights start with 1, followed by 2 and 3. Then it recounts/reset. Putting that into perspective, for example, Cell A2 will be multiplied by weight values of either 1 or 2 depending on which iteration/round/rotation it’s on.

The rowIndex() comparison is used to account for the first two rows. The round() is for ease of reading. As always, make sure to properly initialize the access feature in the settings of the CE.

Hi @badger101 , is the lookback period dynamic? Does this need to be calculated automatically based on the lookback period? Or will you adjust manually for 2, 3, 4, etc?

This works! Very creative and efficient, thanks a lot @ArjenEX !

@bruno29a The lookback period is fixed at 10 (the dummy example used was 3 for simplicity purposes). But feel free to share a solution for a dynamic case, perhaps it would be useful for me in the future and for others. At this point in time, what @ArjenEX did is already sufficient for what I’m looking for.

The lookback in the solution you had mentioned from me is dynamic. This is why it is more complex. It is dynamic in terms of the number of weights and their values. One just needs to fill a table with the required number and values of weights and it should work.

I’m not yet in the office but will send soon an example based on your data if this may help.

I added a -Rule Engine- node at the end of the workflow to set to Zero the initial row results that have index less than the number of weights in your mask:

Thank you @aworker for taking the time. Yes, based on your explanation and images, I get how it should work for my case now. The Rule Engine trick at the end is the key. Again, thanks for sharing!