2 Replies Latest reply on Jun 13, 2018 1:45 AM by wc chua

# Duration calculation and distance calculation

I have a data file with millions of rows with timestamp as one of the column. In the timestamp column, it comprises date and time as shown below.

would like to ask if there is any ways to calculate the total duration for (e.g. Model X)from the timestamp that is in mode 2?

e.g. there is 4 mode(1,2,3,4). I would like to find the total duration model X stays in mode 2 before changing to mode 1 in this context

`    Index,Model,Timestamp,Mode,lat,long    0,X,2018-05-31 09:15:32.869,2,1.3539,103.84    1,X,2018-05-31 09:15:32.869,2,1.3545,103.84    2,Y,2018-05-31 09:18:20.870,2,1.3839,103.7002    3,X,2018-05-31 09:18:20.870,1,1.3548,103.84    4,Y,2018-05-31 09:21:14.868,2.1.3831,103.71    5,Z,2018-05-31 09:21:14.868,2,1.3139,103.88`

For part 2, i would like to calculate the distance for model X from "Index 0 --> Index1 , Index 1--> Index 3" using the lat long field

• ###### 1. Re: Duration calculation and distance calculation

Hi, WC Chua

Not very sure what's your logic behind, e.g. Y mode 2, it doesn't go to mode 1, how do you know how long it stay at mode 2?

ZZ

• ###### 2. Re: Duration calculation and distance calculation

Hi, this is just a tiny portion of my data therefore there is insufficient details. But the main logic behind my question is to calculate duration from mode to mode and calculate distance from a set of lat long to another set of lat long. Sorry if the questions is unclear