Date in Row Difference Calculation

Highlighted
SteveP
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
kgdku Dataiker
Dataiker
Re: Date in Row Difference Calculation
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
0 Kudos