Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to compare the two line value and choose the Min Date

How to compare the two line value and choose the min time.

e.g.  I have a table below. When there are the same Case_ID, select the Min Arrival Time.

 

CASE_IDSWO_IDArrival_TimeDeparture_Time
CAS-83372-F0N5SWO-703072015/12/12 0:002015/12/13 0:00
CAS-83376-F4Q3SWO-703082015/12/9 0:002015/12/10 0:00
CAS-83377-L5S3SWO-703102015/12/10 0:002015/12/11 0:00
CAS-83377-L5S3SWO-713452015/12/16 0:002015/12/17 0:00
CAS-83379-D1V5SWO-703142015/12/11 7:002015/12/12 7:00

Result:  When the Arrival Time is Min value, to calculate the Duration.  

CASE_IDSWO_IDArrival_TimeDeparture_TimeDuration
CAS-83372-F0N5SWO-703072015/12/12 0:002015/12/13 0:001
CAS-83376-F4Q3SWO-703082015/12/9 0:002015/12/10 0:001
CAS-83377-L5S3SWO-703102015/12/10 0:002015/12/11 0:001
CAS-83377-L5S3SWO-713452015/12/16 0:002015/12/17 0:000
CAS-83379-D1V5SWO-703142015/12/11 7:002015/12/12 7:001
1 Solution

Accepted Solutions
sunny_talwar

May be this:

Table:

LOAD CASE_ID,

    SWO_ID,

    Arrival_Time,

    Departure_Time

FROM

[https://community.qlik.com/thread/213993]

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

Left Join (Table)

LOAD CASE_ID,

  Min(Arrival_Time) as Arrival_Time,

  FirstSortedValue(Departure_Time, Arrival_Time) - Min(Arrival_Time) as Duration

Resident Table

Group By CASE_ID;

Capture.PNG

View solution in original post

2 Replies
sunny_talwar

May be this:

Table:

LOAD CASE_ID,

    SWO_ID,

    Arrival_Time,

    Departure_Time

FROM

[https://community.qlik.com/thread/213993]

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

Left Join (Table)

LOAD CASE_ID,

  Min(Arrival_Time) as Arrival_Time,

  FirstSortedValue(Departure_Time, Arrival_Time) - Min(Arrival_Time) as Duration

Resident Table

Group By CASE_ID;

Capture.PNG

View solution in original post

Not applicable
Author

Hi Sunny,

I try your Function and it looks fine. Thanks a lot.