Hi!
I need to calculate the delta between two rows, for each row, taking into consideration the timestamp and for each user id.
I have these columns and I must calculate column Delta A example:
For each user_id I have to:
sort the timestamp (with sorter node)
Then I have to calculate the difference for the column “A” between the timestamp 2 - timestamp 1, timestamp 3 - timestamp 2 etc…
How can I do that?
The first timestamp for each user id should be 0.
Start with extracting date from the timestamp then use Group Loop start node (group is date and user ID). In the loop use Lag Column node and Math Formula node. After the Loop end node replace null values with 0 in the delta column (the first row in the group should be 0)
Thanks! I think there is something wrong in the node group loop start because If I set group as data and user id, I will obtain only one row in the entire file.
Otherwise If I set group every columns it works.
I Have “?” values in rta(-1). Why? I need all values
It seems it does not sort for time because if you see for example in column Delta A the value = -18, the time is at 10:04:41, and it is not after the previous one at 12:43:52… How can I sort for time?
The red ? is missing value and is the start of the group (Lag column node create it)… you have to replace that with the 0 … Look at the missing value node in may example
Try to use the Sorter node before the Group loop start