Survey banner
The Dataiku Community is moving to a new home! Some short term disruption starting next week: LEARN MORE

Date in Row Difference Calculation

Level 1
Date in Row Difference Calculation
Trying to find a simple way to calculate the difference in datetime between rows in a column. Number of rows in dataset very large therefore pivot will not work. Where deltadatetime of current row = datetime of next row - datetime of current row by unique ID

{ID] [DateTime] [Code] [DeltaDateTime]
0 Kudos
1 Reply
Dataiker Alumni

Assuming your IDs are unique in the dataset

You can use a window recipe with the following settings

- order columns: ID

- window frame: limit the number of preceeding (or) following rows = 1

- aggregation -> lag (or lead) diff ( you can choose in seconds up to years) or use a custom aggregation