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.

Not applicable

How to get the first or last instance

Hi,

May I ask how to get the first or second or last instance for the query below.

I would like get the first and second instance of Transferre Date per Ticket. But as you can see in the attached image, most of the ticket number have duplicates because one ticket can transfer many times. My problem is how will I be able to get the first and second instance of transferred date.

Thank you

3 Replies
Henric_Cronström
Not applicable

Re: How to get the first or last instance

If you use "Ticket" as dimension in a chart, and your "Transferred Date" is correctly interpreted as a date, then you can simply use

   Date(Min([Transferred Date]))

for the first "Transferred Date" for that ticket. And you can use

   Date(Min([Transferred Date], 2))

for the second "Transferred Date".

HIC

Not applicable

Re: How to get the first or last instance

Hi Henric,

Im sorry for confusion.

I have four fields to use for this script.

1. Ticket

2 Assignee

3. Date Opened

4. Transferred Date.

Query 1: My dimension will be the Assignee, and im going to count the tickets transferred in first instance. Ticket number may have duplicates depends on how many times it was transferred.

Query 2: Same as with Query 1 but this time im going to get the second instance of transferred date.

Thank you

Henric_Cronström
Not applicable

Re: How to get the first or last instance

I would then try:

Query1: Count(Aggr(distinct Min([Transferred Date],1),Ticket))

Query2: Count(Aggr(distinct Min([Transferred Date],2),Ticket))

HIC