Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Best calculation of time difference when the data is in multiple rows of a table

Hello,

I'd like to get some advice on how best to calculate time difference when the data is in multiple rows of a table.

In the example below (POR to next PIR) is easy to calculate in Excel by setting the later PIR_TIME minus the earlier POR_TIME for the surgeon.

However, when I've tried to recreate this in Qlikview, I keep getting errors.

I've done something similar to this in SQL using a CTE but am not as well-versed as how to handle this dynamically in Qlikview - in the load script, functions, etc.

Welcome your responses!

Regards,

Karen

   

PROCEDURE_DATE_DTCASE_CONFIRMATION_NUMSURGEONPIR_TIMEPOR_TIMEPOR to next PIR
07/20/20151Dr. B07:3609:36
07/20/20152Dr. B09:5913:2023
07/20/20153Dr. B13:0515:00-15
07/20/20154Dr. B14:4016:14-20
12 Replies
Not applicable
Author

Hi Massimo,

This is a good suggestion - I will try to do the table join and re-post!

Much appreciation!

maxgro
MVP
MVP

z:

load field1, field2, Evaluate(pir) as pir, Evaluate(por) as por inline [

field1, field2, pir, por

a,1, 1/24, 2/24

a,2, 3/24, 4/24

a,3, 5/24, 6/24

b,1, 17/24, 18/24

b,2, 20/24, 22/24

b,3, 23/24, 0.99999

];

left join (z)

load

field1, field2+1 as field2, por as por_prevrow

Resident z;

1.png

Not applicable
Author

Hi Massimo,

Thank you very much for your example.

My only caveat is that the CASE_CONFIRMATION_NUMBER may not be sequential, hence cannot assume it is +1.

I will work on tweaking the LEFT join.