i am supposed to generate the last 4 columns (referring as result columns E to H) using the data from the first 4 columns (referring as data columns A to D).
The first row in the result column is copied from the first row of the data column.
The formulas for column 5 and 6 (grouped_create_date and grouped_id) is as below from excel.
Formula is cell E5 = =IF(AND(AND($C2=$C3,$D2=$D3),$A3-$E2<30),$E2,$A3)
Formula is cel E6 = =IF(AND(AND($C2=$C3,$D2=$D3),$A3-$E2<30),$F2,$B3)
Cell E(n) and Cell F(n) is a copy from Cell C(n) and Cell D(n).
Data is as below.
create_date | id | accountid | country | grouped_create_date | grouped_id | accountid | country |
---|---|---|---|---|---|---|---|
6/2/2016 | OPP1 | A1 | Australia | 6/2/2016 | OPP1 | A1 | Australia |
5/25/2017 | OPP2 | A1 | Australia | 5/25/2017 | OPP2 | A1 | Australia |
5/26/2017 | OPP3 | A1 | Australia | 5/25/2017 | OPP2 | A1 | Australia |
5/26/2017 | OPP4 | A1 | Australia | 5/25/2017 | OPP2 | A1 | Australia |
9/22/2017 | OPP5 | A2 | Netherlands | 9/22/2017 | OPP5 | A2 | Netherlands |
9/22/2017 | OPP6 | A2 | Netherlands | 9/22/2017 | OPP5 | A2 | Netherlands |
12/27/2017 | OPP7 | A2 | Netherlands | 12/27/2017 | OPP7 | A2 | Netherlands |
2/16/2016 | OPP8 | A3 | China | 2/16/2016 | OPP8 | A3 | China |
2/17/2016 | OPP9 | A3 | China | 2/16/2016 | OPP8 | A3 | China |
3/14/2016 | OPP10 | A3 | China | 2/16/2016 | OPP8 | A3 | China |
4/11/2016 | OPP11 | A3 | China | 4/11/2016 | OPP11 | A3 | China |
4/25/2016 | OPP12 | A3 | China | 4/11/2016 | OPP11 | A3 | China |
6/2/2016 | OPP13 | A3 | China | 6/2/2016 | OPP13 | A3 | China |
3/2/2016 | OPP14 | A4 | Australia | 3/2/2016 | OPP14 | A4 | Australia |
3/2/2016 | OPP15 | A4 | Australia | 3/2/2016 | OPP14 | A4 | Australia |
3/16/2016 | OPP16 | A4 | Australia | 3/2/2016 | OPP14 | A4 | Australia |
5/19/2016 | OPP17 | A4 | Australia | 5/19/2016 | OPP17 | A4 | Australia |
6/24/2016 | OPP18 | A4 | Australia | 6/24/2016 | OPP18 | A4 | Australia |
I am able to use the lag column and rule engine node. To generate the nth row in the result column (5 and 6), how do I store the variables from (n-1)th row so that I can use in the formula above?
I saw a post on Java snippet variable (understood that to be a substitute of lag column). Saw on recursive loop but I am not sure how to apply here.
Appreciate your time.
Thanks,
Shalini