Forum Discussion

JDR100's avatar
JDR100
New Member
2 years ago
Solved

How to Group Consecutive Datetimes

I have a series of date times. 

I want to group consecutive datetimes where there is a maximum of 10 minutes between a period.

I can easily find the time diff between consectuve times by adding index and subtracting. The challenge is from there to add a column to group these by.

  • Hi JDR100 ,
    you can add a column where you check if the calculated time is larger than your threshold and if so, return the index else return null. This will return a table with a number in it whenever a new group must be created.
    Then check that new column and fill down values. That will fill down the index value and you can then group on it.

1 Reply

  • ImkeF's avatar
    ImkeF
    Icon for Community Champion rankCommunity Champion

    Hi JDR100 ,
    you can add a column where you check if the calculated time is larger than your threshold and if so, return the index else return null. This will return a table with a number in it whenever a new group must be created.
    Then check that new column and fill down values. That will fill down the index value and you can then group on it.