Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
ValeriaBonini
Partner - Creator
Partner - Creator

If condition with wildmatch

Hi, I have a table like this:

Product      Category

A                    BP something

B                    BP Analysis

C                    BP test

D                    Something

 

How can I create a new column "Type" that if category contains BP* it has value 1, if it doesn't contain BP has value 0 and if contains BP test it has value 'other'?

Product      Category                      Type

A                    BP something            1

B                    BP Analysis                 1

C                    BP test                         Other

D                    Something                 0

 

I tried 

if(wildmatch(Category, 'BP*'), 1,  '0') as Type

but I don't know how to include the last if condition

Labels (5)
1 Solution

Accepted Solutions
Aditya_Chitale
Specialist
Specialist

Something like this ?

if(wildmatch(Category,'BP test'),'Other',
     if(wildmatch(Category,'BP*') ,'1',
         if(not wildmatch(Category,'BP*'),'0'))) as Type

 

Aditya_Chitale_0-1687166134339.png

Regards,

Aditya

View solution in original post

2 Replies
Aditya_Chitale
Specialist
Specialist

Something like this ?

if(wildmatch(Category,'BP test'),'Other',
     if(wildmatch(Category,'BP*') ,'1',
         if(not wildmatch(Category,'BP*'),'0'))) as Type

 

Aditya_Chitale_0-1687166134339.png

Regards,

Aditya

BrunPierre
Partner - Master II
Partner - Master II

As below.

Text(If(WildMatch(Category,'BP*') and WildMatch(Category,'*BP test*')=0,1,
If(WildMatch(Category,'*BP*')=0,0,
If(WildMatch(Category,'*BP test*'),'other')))) as Type