How to set lag no.as variable to run loop in Lag column

Hi Knime experts
I have below part with difference lag request for demand.
image
I use table row to variable loop start to set lag no. as variable, but I don’t know what’s wrong, the workflow can get the result what I want.
Thanks for help in advance.

Below picture show my workflow result and what I want, hope it’s clear for understanding.

Hi @Chenfang,

is something like this working for you?

Let me know,
RB

2 Likes

Hi Lelloba
Thank you so much for your prompt reply and perfect solution. It works.

1 Like

Hi Lelloba
I have another question, if I want lag with negative, how to set up, thanks!
image

In that case you have to use another node called Moving Aggregation.

See this post: Lag Column with Negative value? - #8 by Isabell

Alternative: this node

RB

1 Like

OK, thanks, let me try.

1 Like

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