Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

aveeeeeee7en
Valued Contributor III

Min In DateTime & Max Out DateTime against Distinct TicketID in the Best Possible Way

Hi All

I have to find Min In DateTime  Max Out DateTime against Distinct TicketID

Below I am using the Code to find Min & Max Date.

My Questions are:

1) Is the code I am using is the correct way

2) Is there any other alternate way

3) Can I use First Sorted Value

See my Code:

Table:
LOAD TicketID,
     SerialNumber,
     CreationDateTime
FROM

(qvd);

Left Join

LOAD TicketID,
     InDateTime
FROM

(qvd);

Left Join(Table)

LOAD TicketID,
     ENG_OUT_TIME
FROM

(qvd) WHERE MATCH(UPPER(STATUS),'CLOSED','TELE CLOSURE','MACHINE UNDER OBSERVATION');

PFA.

Regards

Av7eN

Tags (1)
4 Replies
anbu1984
Honored Contributor III

Re: Min In DateTime & Max Out DateTime against Distinct TicketID in the Best Possible Way

You can use FirstSortedValue to get min and max date

aveeeeeee7en
Valued Contributor III

Re: Min In DateTime & Max Out DateTime against Distinct TicketID in the Best Possible Way

First Sorted Value is nice But the Code I am using is the right Approach or not.

Kindly Suggest.

venkatasreekant
Valued Contributor

Re: Min In DateTime & Max Out DateTime against Distinct TicketID in the Best Possible Way

Hi,

Use the code like in the attachments...

anbu1984
Honored Contributor III

Re: Min In DateTime & Max Out DateTime against Distinct TicketID in the Best Possible Way

If you don't need other than Min value, then you calculate Min before Join


LOAD TicketID,

     Min(InDateTime)

FROM

(qvd)

Group By TicketID;