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

Calculating how long a request takes

Hi,

I'd like to ask how I can calculate the total time between two dates and then display this data in a visual representation?

For instance:

Open Dates:

5/24/2014

6/11/2014

6/22/2014

6/22/2014

9/12/2014

Close Dates:(respectively)

5/24/2014

6/12/2014

6/23/2014

6/22/2014

11/11/1014

Then what I am looking for is a new table that I would like to display in hours

Hours Open:

2

12

14

1

1443

I know how to take the data and display it, but I am more so aiming to display statistics on how long a ticket was open with support or a secondary approver.

Any thoughts?

Thanks Kindly

21 Replies
Not applicable
Author

@Piet,

I am using a personal version so I cannot see your file, but example load of what I am doing is heredifference.jpg

Not applicable
Author

And although I am still trying to display the difference of time between the two dates,

When I choose the only value in the list box with the expression, it isolates one valuedifference.jpg

MarcoWedel

please post some lines of your source file.

thanks

regards

Marco

MarcoWedel

formatting your Difference field as Timestamp makes no sense as it contains the integer part of the number of hours.

i.e. 4632:00:00 is displayed for a difference of actually only eight days:

4632/(24*24) = 8

try

Interval(Floor(complete_date-create_date,'01:00:00')) as Difference

instead.

hope this helps

regards

Marco

stigchel
Partner - Master
Partner - Master

This is probably about your date format, can you try with:

Interval(timestamp(complete_date), 'hh:mm:ss')-timestamp(create_date), 'hh:mm:ss'), 'D hh:mm') as Diff;

If that does not help please post a sample qvw, or at least some lines of your source data.

This is what I had:

Data:

LOAD *, Interval([Close Dates]-[Open Dates], 'D hh:mm') as Diff;

Load * inline [Open Dates,Close Dates

5/24/2014 12:00:00,5/24/2014 16:00:00

6/11/2014 12:00:00,6/12/2014 17:21:00

6/22/2014 12:00:00,6/23/2014 18:11:00

6/22/2014 12:00:00,6/22/2014 20:22:00

9/12/2014 12:00:00,11/11/2014 13:51:00

];

Result:

Interval.png

Not applicable
Author

@Piet,

I tried this method in my QVW and also in a test QVW but could not get results for diff.

Is there something in the sheet object that I need to change? I can't seem to display any results for the Diff columndiff.png

Not applicable
Author

Hey Marco,

By source data I think you mean the original data where I am pulling my information from.

Here are a few lines from my source.

     

request_idcreate_datesubmit_datecomplete_datestatus_dateroute_status
2567136/9/2015 08:24:48:346/9/2015 08:26:15:4676/9/2015 10:26:41:7936/9/2015 10:26:41:793Approved
2567136/9/2015 08:24:48:346/9/2015 08:26:15:4676/9/2015 10:26:41:7936/9/2015 10:26:41:793Submitted
2567166/9/2015 08:35:52:3436/9/2015 08:39:34:6736/9/2015 10:25:15:3236/9/2015 10:25:15:323Approved
2567166/9/2015 08:35:52:3436/9/2015 08:39:34:6736/9/2015 10:25:15:3236/9/2015 10:25:15:323Submitted
2567526/9/2015 10:21:26:96/9/2015 10:24:43:8576/9/2015 10:24:54:1076/9/2015 10:24:54:107Approved
2567526/9/2015 10:21:26:96/9/2015 10:24:43:8576/9/2015 10:24:54:1076/9/2015 10:24:54:107Submitted
2429222/6/2015 08:50:54:392/6/2015 08:58:46:0532/6/2015 09:15:26:557Pending
2516144/29/2015 15:29:33:584/29/2015 15:47:44:8835/5/2015 07:23:19:82Rejected
2516144/29/2015 15:29:33:584/29/2015 15:47:44:8835/5/2015 07:23:19:82Pending
stigchel
Partner - Master
Partner - Master

Yes, so it was your date format. I've successfully tested the following:

Load *,Interval([complete_date]-[create_date], 'D hh:mm') as Diff;

LOAD request_id,

     Date(Date#(create_date,'D/MM/YYYY hh:mm:ss:fff')) as create_date,

     Date(Date#(submit_date,'D/MM/YYYY hh:mm:ss:fff')) as submit_date,

     Date(Date#(complete_date,'D/MM/YYYY hh:mm:ss:fff')) as complete_date,

     status_date,

     route_status

FROM

[https://community.qlik.com/thread/168043?sr=inbox&ru=200580]

(html, codepage is 1252, embedded labels, table is @2);

Diff.png

Not applicable
Author

Hey Marco,

So I tried this line and I think there is something basic I am not understanding.

There is something in my objects that Isolates the date to one value. I'm also trying to expand that as well.

Otherwise the format looks okay in HH:MM:SS if that is what is displayed.

Thank you for your patience with me

diff.png

Not applicable
Author

@Piet

Okay!! I'm getting somewhere. I see how you load the interval first as a separate line.

I also see how you formatted the dates beforehand as well.

I also appreciated how you were able to pull the data specifically from my entry on this webpage. That was cool.

Now I am looking to fix up some values and trying to understand why some values are negative here.diff.png