Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
BusinessCo
Contributor
Contributor

Calculation time spent between multiple timestamps

Hi,

I have data with multiple timestamp pro day. What i need is to calculate the time between first en last stamp pro day. In example below the tme between 07:04:09 and 14:31: 49 is 07:27:40.

Can somebody help me? Thanx!

License PlateTimeNumber of emptyings
59-BDS-607:04:091
59-BDS-607:51:151
59-BDS-608:06:261
59-BDS-608:41:221
59-BDS-609:56:201
59-BDS-609:59:081
59-BDS-610:59:291
59-BDS-610:59:501
59-BDS-611:24:301
59-BDS-611:25:401
59-BDS-613:56:401
59-BDS-613:59:481
59-BDS-614:23:361
59-BDS-614:31:491

 

The result must be:

License PlateTotal time spentNumber of emptyings
59-BDS-607:27:4014
Labels (3)
2 Solutions

Accepted Solutions
tresesco
MVP
MVP

Time(max(Time#(Time, 'hh:mm:ss'))-Min(Time#(Time, 'hh:mm:ss')), 'hh:mm:ss')

tresesco_0-1592997017708.png

 

View solution in original post

NitinK7
Specialist
Specialist

Hi,

try like below

dimension- License Plate

Expression_1(Total time spent)-  Time(FirstSortedValue(Time,-Time)-FirstSortedValue(Time,Time),'hh:mm:ss').

Expression_2(Number of emptyings)- count([Number of emptyings]).

See below screenshot

Capture.PNG

Thanks

Nitin.

View solution in original post

4 Replies
tresesco
MVP
MVP

Time(max(Time#(Time, 'hh:mm:ss'))-Min(Time#(Time, 'hh:mm:ss')), 'hh:mm:ss')

tresesco_0-1592997017708.png

 

Taoufiq_Zarra

One solution :

Data:

LOAD * INLINE [
    License Plate, Time, Number of emptyings
    59-BDS-6, 07:04:09, 1
    59-BDS-6, 07:51:15, 1
    59-BDS-6, 08:06:26, 1
    59-BDS-6, 08:41:22, 1
    59-BDS-6, 09:56:20, 1
    59-BDS-6, 09:59:08, 1
    59-BDS-6, 10:59:29, 1
    59-BDS-6, 10:59:50, 1
    59-BDS-6, 11:24:30, 1
    59-BDS-6, 11:25:40, 1
    59-BDS-6, 13:56:40, 1
    59-BDS-6, 13:59:48, 1
    59-BDS-6, 14:23:36, 1
    59-BDS-6, 14:31:49, 1
];

output:

load [License Plate],sum([Number of emptyings]) as [Number of emptyings], Interval ( (time(max(Time)))  -(time(min(Time))) , 'hh:mm:ss' ) as [Total time spent] resident Data group by [License Plate]; 

drop table Data;

 

output :

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
NitinK7
Specialist
Specialist

Hi,

try like below

dimension- License Plate

Expression_1(Total time spent)-  Time(FirstSortedValue(Time,-Time)-FirstSortedValue(Time,Time),'hh:mm:ss').

Expression_2(Number of emptyings)- count([Number of emptyings]).

See below screenshot

Capture.PNG

Thanks

Nitin.

BusinessCo
Contributor
Contributor
Author

Thank you very much!