Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
yashcena
Contributor III
Contributor III

Create Flag colun

I have a dataset which looks like this:

Capture.JPG

Each account id has multiple products.

I have to create a table which should have a column named XYZ_FLAG (y/n).

If an account id has either of aaa,bbb,eee products and doesnt have either xxx, www products, then this flag column should be marked Y.

The table would like this:

Capture.JPG

1011 has aaa, bbb and eee products and does not have xxx or www products, Y

1012 has aaa product and does not have xxx or www, Y

1013 had bbb and does not have xxx or www, Y

1014 has eee but it also has xxx, N

1015 does not have either aaa or bbb or eee, N

Similarly there should be another column ABC_FLAG (y/n)

If an account id has either of ddd,eee,xxx products and doesnt have hhh product, then this flag column should be marked Y.

Capture.JPG

1011 has  ddd and eee and does not have hhh, Y

1012 does not have ddd or eee or xxx, N

1013 does not have ddd or eee or xxx, N

1014 has ddd and eee and does not have hhh, Y

1015 does not have ddd or eee or xxx, N


Is this doable in qlikview?


I hope I have made my requirement clear.


Thanks,

YASH

2 Replies
PrashantSangle

Hi,

Try below

Load Acct_id,

if(not wildmatch(NewProduct ,'xxx','www'),'N','Y') as xyz_flag,

if(not wildmatch(NewProduct ,'hhh'),'N','Y') as xyz_flag;

Load Acct_id,concat(Product,',') as NewProduct from table;


Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
olivierrobin
Specialist III
Specialist III

hello

may be this

first load your data in a table (here named p)

and then create a second table

load ID,
if(max(if(match(Product,'aaa','bbb','eee'),1,0))*max(if(match(Product,'xxx','www'),0,1))=1,'Y','N') as XYZ_FLAG,
if(max(if(match(Product,'ddd','eee','xxx'),1,0))*max(if(match(Product,'hhh','hhh'),0,1))=1,'Y','N') as ABC_FLAG
resident p
group by ID