Two directions Lag columns

Hi, I would like to follow up on someones’post from 3 years ago which found extremely useful. Does anyone knows how to produce two directional lag columns?
“The “premium version” would be able to produce both directions at the same time, allowing the user to choose which copy to use as the base. This version wouldn’t necessarily need negative intervals, of course.”

Thanks

If you want to do such a Thing you could try and modify this approach:

I’ve included python node with lag in both directions.
Please verify whether you wanted such a result?

python_shift.knwf (6.6 KB)

— Robert

1 Like

Thanks for helping I ended up having the same output. It might be easier to it in excel.
Thanks again

Thanks for your help. I wasn’t able execute it probable because I don’t have python installed.
Thanks

Hi together,

i think you can introduce a negativ lag if you:

  • extract the Row id of your table with the RowID Node
  • use the Lag Column Node on the extracted ids (introduce the lag you need)
  • Join the new table with lagged ids back to your original table on the unaltered RowIDs (use Left or Right Outer Join as desired).
    I think the resulting table would be like a negative lag. You can use Quickforms to parameterize some of the nodes, so you can encapsulate it in a reusable metanode.
    Could that help you?
1 Like