Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
atulkrsingh
Contributor II
Contributor II

Finding unique time intervals in case of overlap

Hi there,

I'm new to Qlik and having trouble with the following dataset:

Patient IDAppointment DateDoctorStart timeEnd timeAppointment time
11-Jan-20A9:00 AM10:00 AM1:00
21-Jan-20A11:00 AM11:30 AM1:00
31-Jan-20A11:00 AM12:15 PM1:15
41-Jan-20A12:00 PM1:00 PM1:00
51-Jan-20A4:00 PM5:00 PM1:00
61-Jan-20B10:00 AM11:30 AM1:30
71-Jan-20B4:00 PM5:00 PM1:00
81-Jan-20B4:00 PM5:00 PM1:00

 

I need to find out the actual work time for the practitioners,

Here, 

For, Practitioner A - Total Appointment time = 4:45:00;
                                         Actual Work Time = 4:00:00

For, Practitioner B - Total Appointment time = 3:30:00;
                                         Actual Work Time = 2:30:00

 

Required Output:

Appointment DateDoctorActual Work Time
1-Jan-20A4:00:00
1-Jan-20B2:30:00

 

I was thinking of,
                  Actual Work Time =   Aggr(Sum(Interval( Min([Start Date]) - Max([End Date]))   - (Total time of NO Work ))

However, I'm unsure of how to write the query for Total Time of No Work (i.e., when the Practitioner is not working)

Thanks in Advance for your help

 

Best Regards,

Atul 

 

10 Replies
Kushal_Chawda

Is it data issue then? Do let me know if you need to correct it for other cases