Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

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

Re: Average waitingtime

See attached. Hope it helps.

5 Replies
Not applicable

Re: Average waitingtime

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

Not applicable

Re: Average waitingtime

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
Honored Contributor II

Re: Average waitingtime

=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

Re: Average waitingtime

See attached. Hope it helps.

Not applicable

Re: Average waitingtime

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.

Community Browser