Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Timediff between 2 rows depending on index

Hi all,

 

How would I calculate the time difference between 2 rows depedning on an index column?

 

Example:

Waste Stop: 2021-03-17 05:52:47

Waste Start: 2021-03-17 06:32:36

Index: 0

Wanted result: time difference (format could be seconds..)

 

  • Anonymous , Create a new column like

     


    new column =
    var _max = maxx(filter(Table, [Index] = earlier([Index]) -1 ),[Waste Stop])
    return
    datediff(maxx(filter(Table, [Index] = earlier([Index]) -1 ),[Waste Stop]),[Waste Start], second)

2 Replies

  • Anonymous , Create a new column like

     


    new column =
    var _max = maxx(filter(Table, [Index] = earlier([Index]) -1 ),[Waste Stop])
    return
    datediff(maxx(filter(Table, [Index] = earlier([Index]) -1 ),[Waste Stop]),[Waste Start], second)

  • Anonymous's avatar
    Anonymous
    Not applicable

    Just perfect!

    Thank you!