Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate duration (creationdate - closuredate)

Hello,

I'm trying to calculate the duration of creation and closure date.

Tried the following:

SQL SELECT

datumaangemeld                                          AS IN_DATE_creation_date

datumafgemeld                                                  AS IN_DATE_closure_date,

datumafgemeld - datumaangemeld                       AS IN_DATE_duration,

FROM db;

Above code is not working, any suggustions?

I would like to have the data stored as hours:mins:seconds

Thanks!

Screenshot seems not to be working so here table information:

IN_DATE_creation_date
IN_DATE_closure_date
10/29/2004 9:54:00 PM10/29/2004 9:59:01 PM
10/30/2004 10:00:00 PM10/30/2004 10:11:01 PM
1 Solution

Accepted Solutions
nagaiank
Specialist III
Specialist III

For the duration field, in the Number tab, chose interval format 'dd hh:mm:ss'

View solution in original post

5 Replies
nagaiank
Specialist III
Specialist III

Try the following:

LOAD datumaangemeld            AS IN_DATE_creation_date

          datumafgemeld                  AS IN_DATE_closure_date,

          datumafgemeld - datumaangemeld AS IN_DATE_duration;

SQL SELECT

datumaangemeld

datumafgemeld

FROM db;

Displaying the duration in hh:mm:ss can be achieved by specifying the format in the 'Number' tab of chart properties.

Not applicable
Author

Screenshot was not working here table information:

IN_DATE_creation_date
IN_DATE_closure_date
10/29/2004 9:54:00 PM10/29/2004 9:59:01 PM
10/30/2004 10:00:00 PM10/30/2004 10:11:01 PM
Not applicable
Author

Just tried it, looks working; Altough when a duration longer then 24 hours its not working correlty anymore.

nagaiank
Specialist III
Specialist III

For the duration field, in the Number tab, chose interval format 'dd hh:mm:ss'

Not applicable
Author

Thank you, works! also my old code works with just the field adjustments.