Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difference between the open to resolved time on records

Hi ,Experts please  provide the solution for this case

Priority ID

Stage IDTimeCase ID
1101/01/2010 00:00:00ABC112233445567050
1201/01/2010 00:12:00ABC112233445567050
1301/01/2010 08:42:44ABC112233445567050
1401/01/2010 08:54:44ABC112233445567050
1501/01/2010 14:38:32ABC112233445567050
1101/01/2010 10:34:32ABC112233445567095
1201/01/2010 11:09:32ABC112233445567095
1301/01/2010 17:55:05ABC112233445567095
1401/01/2010 18:10:05ABC112233445567095
1501/01/2010 19:26:57ABC112233445567095
1101/01/2010 13:43:10ABC112233445567113
1201/01/2010 14:14:10ABC112233445567113
1301/01/2010 17:27:53ABC112233445567113
1401/01/2010 17:40:53ABC112233445567113

Stage ID is the Field under the stage ID these are the records,

StageID 1=Open

StageID 2=Assign

StageID3=Development

StageID 4=Test

StageID 5=Resolved

I want to take  the difference in between the open to resolved  time in back end(Script).

4 Replies
Gysbert_Wassenaar

Something like this:

input:

LOAD

  [Priority ID]

, [Stage ID]

, Timestamp#([Time],'DD/MM/YYYY hh:mm:ss') as [Time]

, [Case ID]

INLINE [

    Priority ID, Stage ID, Time, Case ID

    1, 1, 01/01/2010 00:00:00, ABC112233445567050

    1, 2, 01/01/2010 00:12:00, ABC112233445567050

    1, 3, 01/01/2010 08:42:44, ABC112233445567050

    1, 4, 01/01/2010 08:54:44, ABC112233445567050

    1, 5, 01/01/2010 14:38:32, ABC112233445567050

    1, 1, 01/01/2010 10:34:32, ABC112233445567095

    1, 2, 01/01/2010 11:09:32, ABC112233445567095

    1, 3, 01/01/2010 17:55:05, ABC112233445567095

    1, 4, 01/01/2010 18:10:05, ABC112233445567095

    1, 5, 01/01/2010 19:26:57, ABC112233445567095

    1, 1, 01/01/2010 13:43:10, ABC112233445567113

    1, 2, 01/01/2010 14:14:10, ABC112233445567113

    1, 3, 01/01/2010 17:27:53, ABC112233445567113

    1, 4, 01/01/2010 17:40:53, ABC112233445567113

];

result:

load

  *

, if([Stage ID]=1,Time,peek(StartTime)) as StartTime

, if([Stage ID]=5,interval(Time-peek(StartTime),'hh:mm:ss')) as Duration

Resident input

order by [Case ID],[Time];

drop table input;

Replace the inline load with something that loads your real data.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Manoj

Maybe you can try this:

LOAD [Priority ID],

     [Stage ID],

     Time,

     [Case ID],

    if(previous(previous(previous(previous([Case ID])))) = [Case ID], date(date(Time, 'hh:mm:ss') - previous(previous(previous(previous(date(Time, 'hh:mm:ss'))))), 'hh:mm:ss')) As Difference

FROM

......

Let me know if this works for you.

Kind regards

Anonymous
Not applicable
Author

gwassenaar


That is great !!!

I had a similar requirement earlier this week and my solution was ugly, lengthy and inefficient - although it did work.


Your suggestion is elegant, simple and I reckon will be efficient.  I just need to adapt it to my scenario.

Many Thanks,     Bill

Not applicable
Author

Thank you gwassenaar and jacobsbritt2 it worked  appreciate your early response.