Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
sivaprakash_t
New Contributor

Duplicate tickets flag calculation

Hi Friends,

I have some fields like Branch, Case,Down_since and Up_Since, now my issue is multiple tickets have same Up_since in a branch. I need to captured same Up_since tickets as flag 1 and minimum down_since for that tickets should be flag as 0, I'm attaching one excel file in that one Output column is there i'm expecting that...Please help me friends.

Capture.JPG

Tags (1)
1 Solution

Accepted Solutions
luciancotea
Valued Contributor

Re: Duplicate tickets flag calculation

When you load the data in the script, order by Up_Since and Down_Since DESC and use peek() to see if the previous row have the same Up_Since, like:

TABLE2:

LOAD *, if(Branch = peek('Branch') and Up_Since = peek('Up_Since'), 1, 0) as Flag

RESIDENT TABLE1

ORDER BY Up_Since, Down_Since DESC, Branch

DROP TABLE1;

4 Replies

Re: Duplicate tickets flag calculation

I am not sure how you are getting the output. Can you explain the logic

Re: Duplicate tickets flag calculation

I was going to ask the same thing. I am confused

Why are there two 0's in the screenshot

Capture.PNG

luciancotea
Valued Contributor

Re: Duplicate tickets flag calculation

When you load the data in the script, order by Up_Since and Down_Since DESC and use peek() to see if the previous row have the same Up_Since, like:

TABLE2:

LOAD *, if(Branch = peek('Branch') and Up_Since = peek('Up_Since'), 1, 0) as Flag

RESIDENT TABLE1

ORDER BY Up_Since, Down_Since DESC, Branch

DROP TABLE1;

sivaprakash_t
New Contributor

Re: Duplicate tickets flag calculation

Sorry Sunny,

In excel that output column we manually created.Inside Blue colour tickets are duplicate tickets in that red colour ticket is original ticket based that is minimum down_since when compare to all duplicate tickets.

Capture.JPG

Community Browser