Date in Row Difference Calculation

SteveP
SteveP Registered Posts: 1 ✭✭✭✭
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]

Answers

  • kgdku
    kgdku Dataiker Alumni, Registered Posts: 3 ✭✭✭✭
    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
Setup Info
    Tags
      Help me…