Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

time expression definition doubt


Hi guys, could you please help me with this definition?

I have this base table -->

datestatusid
3/2/2014 17:50created1
5/2/2014 13:04started1
10/2/2014 11:02finished1

and what i need is something like this -->

idamount time in createdamount time in startedamount time in finishedamount total time
1date(started) - date(created)date(finished)-date(started)date(currently)-date(finished)date(currently)-date(created)

thanks for any help

gerardo

12 Replies
Not applicable
Author

Hi Whiteline, here an example:

base table

created date (M/DD/YYYY)started date (M/DD/YYYY)finished date (M/DD/YYYY)idcustomer
9/12/20139/15/20139/16/20131A
8/10/20138/11/20138/12/20132A
11/3/201311/5/201311/6/20133A
5/6/20135/9/20135/10/20134B
5/6/20135/9/20135/14/20135B
6/8/20136/10/20136/12/20136C

i have this, thanks to you:

idamount of days in "created"
19/15/2013 - 9/12/2013 = 3 days
28/11/2013 - 8/10/2013 = 1 day

What i need is something similar but by customer:

customeravg amount of days in "created"
A(3+1+2) / 3 = 2 days avg
B((5/9/2013 - 5/6/2013) + (5/9/2013 - 5/6/2013) )  / 2 = 3 days avg
C(6/10/2013 - 6/8/2013) / 1 = 2 days avg

thanks

gerardo

whiteline
Master II
Master II

Ok. The task is to create a table by customer (1) which shows average (3) duration of statuses of each id related to the customer (2).

So that, according to (1) you need customer as chart dimension, (2) you need aggr() function to iterate through each id and calculate duration, (3) you have to use Avg() as aggregation function to combine and shoe the result for each customer.

In terms of expressions it would be:

=Avg(aggr(rangemax(Only({<status={'created'}>}date), Only({<status={'started'}>}date))-Only({<status={'created'}>}date), id, customer))


In your case the customer is not necessary as the ids is unique for each customer.

Not applicable
Author

It Works perfectly! Many thanks

Im going to read more a about rangemax and aggr functions…i think they are very usefull…..

De: whiteline

Enviado el: jueves, 26 de junio de 2014 03:26 a.m.

Para: Pauza, Gerardo

Asunto: Re: - time expression definition doubt

Qlik Community<http://community.qlik.com/>

time expression definition doubt

reply from whiteline<http://community.qlik.com/people/whiteline?et=watches.email.thread> in App Development - View the full discussion<http://community.qlik.com/message/556326?et=watches.email.thread#556326>