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.
sunilkumarqv
Valued Contributor II

Create a flag column based on NUMBER

HI all ,

Please help me to create a FLAG column  below table where for each NUMBER to get Last flag as 1 else 0

NUMBERDATESTATUSFLAG
129/12/2015 :Assigned0
129/12/2015 :Assigned0
129/12/2015 :Resolved1
215/02/2016 :Assigned0
215/02/2016 :In Progress1
304/02/2016 :Pending0
304/02/2016 :Assigned0
304/02/2016 :In Progress0
304/02/2016 :Resolved1
425/02/2016 :Pending0
425/02/2016 :Assigned0
425/02/2016 :In Progress0
425/02/2016 :Resolved1
526/02/2016 :Assigned0
526/02/2016 :In Progress1
1 Solution

Accepted Solutions
MVP
MVP

Re: Create a flag column based on NUMBER

Hi,

Try like this

LOAD

*,

If(Peek('NUMBER') <> NUMBER, 1, 0) AS Flag

FROM DataSource;

Hope this helps you.

Regards,

Jagan.

5 Replies

Re: Create a flag column based on NUMBER

Do you have Timestamp format of Date? If so it will be easy to flag the latest Status based on max(Date)

sunilkumarqv
Valued Contributor II

Re: Create a flag column based on NUMBER

yes have timestamp

can you plz share script hear .

MVP
MVP

Re: Create a flag column based on NUMBER

Hi,

Try like this

LOAD

*,

If(Peek('NUMBER') <> NUMBER, 1, 0) AS Flag

FROM DataSource;

Hope this helps you.

Regards,

Jagan.

Re: Create a flag column based on NUMBER

make sure that You Date is in proper Timestamp format

Data:

LOAD Number,

           num(Date) as Date,

          Status

From Table;

left join(Data)

LOAD  Number,

            max(Date) as Date

           1 as MaxDateFlag

Resident Data

group by Number;

Final:

noconcatenate

LOAD *,

if(len(trim(MaxDateFlag))<=0,0,MaxDateFlag) as Flag

resident Data;

drop table Data;

siddharthsoam
Contributor

Re: Create a flag column based on NUMBER

You can simply use maxstring(date)..

Community Browser