Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Average waitingtime

Hi experts,

i have a table with a startdate and a enddate.

In my script i have a field that calculates the difference between those fields.

INTERVAL(ENDDATETIME - STARTDATETIME) as HandlingSpeed

So when i look at my table i have the following date in it:

ID     Type  StartdateTime            EnddateTime            HandlingSpeed.

1      A       01-01-2012 14:00:00  01-01-2012 14:00:30  0.30

2      A       01-01-2012 14:00:00  01-01-2012 14:01:30  1.30

3      B       01-01-2012 14:00:00  01-01-2012 14:00:20  0.20

4      C       01-01-2012 14:00:00  01-01-2012 14:01:10  1.10

5      B       01-01-2012 14:00:00  01-01-2012 14:00:40  0.40

Now i want the average handlingspeed per type.

I made the following expression:

=avg(aggr(Sum(HandlingSpeed),Type))

this will not give the right answer, does anyone have a idea what i did wrong? I think the problem is in the time format ?!

1 Solution

Accepted Solutions
Not applicable
Author

See attached. Hope it helps.

View solution in original post

5 Replies
Not applicable
Author

Have you tried =avg(sum(interval(HandlingSpeed,'hh:mm')))?

Not applicable
Author

I have tried but i won''t get any result.

When you use that construction you do not have a count per Type also i think?

whiteline
Master II
Master II

=avg(aggr(Sum(HandlingSpeed),Type)) in your case = ((0.3 + 1.3) +(0.2 + 1.1) + 0.4) / 3

What is the right answer ?

Not applicable
Author

See attached. Hope it helps.

Not applicable
Author

ID     Type  StartdateTime            EnddateTime            HandlingSpeed.

1      A       01-01-2012 14:00:00  01-01-2012 14:00:30  0.30

2      A       01-01-2012 14:00:00  01-01-2012 14:01:30  1.30

3      B       01-01-2012 14:00:00  01-01-2012 14:00:20  0.20

4      C       01-01-2012 14:00:00  01-01-2012 14:01:10  1.10

5      B       01-01-2012 14:00:00  01-01-2012 14:00:40  0.40

Average:

A = 0.30 + 1.30 (minutes) = 2 minutes     / 2  = 1 minute average

B = 0.20 + 0.40 (minutes)  = 1 minutes    / 2   = 0.3 minutes average

C = 1.10 minutes / 1 = 1.10 minutes average.