Hello,
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
Rgds