Distance between timestamps that belong to same column

Hi,

I have a column called "date" which is timestamp format:

 

I want to calculate the distance in weeks between 1st date and 2nd date, then 2nd date and 3rd date then 3rd date and 4th date.. and so on.

After calculating the distance in weeks for each and every one, I want to average the distances.

Is there any way I can do that in Knime. And specifically in the Groupby variable in Pattern based aggregation?

I tried time difference but is not exactly what I need.

Hi,

can you explain what is the difference to what you want to achieve to the option Use previous row of the Time difference node?

Something similar you can also do with the Moving aggregation node, by using a window size of 2 and the option range in days.

Best, Iris 

1 Like

Hi Iris,

 I thought twice my problem. the "time difference" node it gives me what I need.

Thanks for replying.

Hi Atz

I have a similar question as yours. I have a date column and a consumer ID column.

I want to calculate for each consumer, what is the time diff between his 1st and 2nd purchase, and so on.

Can you show me how you did this?

Thanks

Use the Group By node, group by customer ID (or whatever), and use min and max aggregation. Then calculate the difference between min and max column.

1 Like