There is a new KNIME forum. You can still browse and read content from our old forum but if you want to create new posts or join ongoing discussions, please visit our new KNIME forum: https://forum.knime.com

Multiple column lag

Member for

3 years 5 months manojmanivannan

Hi,

I have a time series data with columns of consumption of different appliance (eg, TV, Electric kettle, washing machine, and so on ) I would like to lag each of the columns by 3 steps.

I am expecting somthing like this

for house 1:

time | TV | TV(-1) | TV(-2) | TV(-3) | Kettle | Kettle(-1) | Kettle(-2) | Kettle(-3) | Washing Mach| Washing Mach(-1)| and so on. Say i have different appliance in each house. so whatever appliance i have, everything should be lagged by 3 steps. i could use column splitter to feed the appliance into a column list loop, -> lag column -> loop end(column append). but i am not getting the end result. the loop stops when it lags 3 steps for 1st iteration.

Can anyone suggest a simple loop solution for this ?

Thank you,

Comments
Thu, 11/16/2017 - 11:22

Member for

2 years 7 months

johannes_clarifydata

Hi,

a bit late to the party but maybe the OP is still looking for help...

Since we ran into this challenge repeatedly we came up with two general ways of dealing with it.

Solution 1: As suggested by Iris, this simply uses a column list loop and column append loop end.

Solution 2: Builds on collection columns. A bit more complex but helpful if you want to calculate a moderate number of lags for a large number of columns.

Find a simple example KNWF attached.

Best, Johannes