Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sum difference with previous values

Hi,

Can you please help me find a solution to this problem?

I have this set of data:

OPERATOR, DATE

Andrew

01-DEC-17 10:40:17

00:01:19

Andrew

01-DEC-17 10:41:36

00:05:45

Andrew

01-DEC-17 10:47:21

00:00:41

Andrew

01-DEC-17 10:48:02

00:03:03

Nicole

01-DEC-17 10:51:05

00:00:05

Nicole

01-DEC-17 10:51:10

00:00:05

Andrew

02-DEC-17 10:51:15

00:02:55

Andrew

02-DEC-17 10:54:10

00:01:30

Sophie

02-DEC-17 10:55:40

00:01:41

Sophie

02-DEC-17 10:57:21

00:01:33

For each operator i would like to get the differnce between every DATE with the previous one and them sum all of these times in order to get the final lead time; for example:

Andrew, 01-DEC

1st activity 10:41:36 - 10:40:17 --> 00:01:19

2nd activity 10:47:21 - 10:41:36 --> 00:05:45

3rd activity 10:48:02 - 10:47:21 --> 00:00:41

The total amount of time is the sum of the results above

I need to make this in backend.

Thank you in advance

2 Replies
nicu1996
Contributor III
Contributor III

I think that the Interval() function is what you need: Interval - script and chart function ‒ Qlik Sense

Example:

Load

     Interval(end_date - start_date, 'hh:mm:ss') AS Result

;

Anonymous
Not applicable
Author

Hi,

i've tried with Interval but it's not working; how do I get the end date in my case? I have to get the previous one for each date.

Thanks