Column Expression: Difference between timestamps + Identify last row

Hi everyone,

I’ve been trying to calculate the difference between timestamps and to identify the last row in the table using the Column expression node, but couldn’t find a way. Any tips how to solve this?

I have a column that contains timestamps (Date-Time) and wanted to use the Column Expression Node to calculate the difference between the timestamp in the current row and the succeeding row.

| Date-Time           | Rank | NEW |
| 2024-09-10T17:48:53 | 1    |     |
| 2024-09-10T17:48:54 | 2    |     |
| 2024-09-10T17:48:55 | 3    |     |
| 2024-09-10T17:48:56 | 4    |     |
| 2024-09-10T17:48:57 | 5    |     |
| 2024-09-10T17:48:58 | 6    |     |
| 2024-09-10T17:48:59 | 7    |     |
| 2024-09-10T17:49    | 8    | 8   |
| 2024-09-10T17:53:01 | 9    |     |
| 2024-09-10T17:53:02 | 10   |     |
| 2024-09-10T17:53:03 | 11   |     |
| 2024-09-10T17:53:04 | 12   | 12  |

The goal is to use the difference between the timestamps to decide whether the value from column Rank should be assigned to column NEW.

If the difference is bigger than 1 second, the value of Rank from the current row should be written in NEW, otherwise NEW is Null. Since there is no succeeding row after the last row, by default the value of Rank should also be assigned to NEW.

if ( (column(“datacollecttimestamp”) - column(“datacollecttimestamp”, +1)) ) {column(“rank”)} else if ( current row = last row ) {column(“rank”)} else {toNull(“”)}

Have a nice weekend.

Best,

Eren