Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

If Statement Where Field Begins With ...

I am trying to create an IF statement to classify different field values into normalized ranges. I want to make it so if FIELD starts with B it is categorized as 1 in NewField.

I have created the statement below but it is not working as desired. Any help would be appreciated.

If([FIELD] LIKE 'B%','1',

     If([FIELD] LIKE 'Y%','2',

     If([FIELD] LIKE 'P%','3',

     If([FIELD] LIKE 'F%','4',)))) AS NewField

    

Thank you,

dave

1 Solution

Accepted Solutions
sunny_talwar

Try this may be:

Pick(WildMatch(FIELD, 'B*', 'Y*', 'P*', 'F*'), 1, 2, 3, 4) as NewField

assuming you were using % for wild card

View solution in original post

3 Replies
sunny_talwar

Try this may be:

Pick(WildMatch(FIELD, 'B*', 'Y*', 'P*', 'F*'), 1, 2, 3, 4) as NewField

assuming you were using % for wild card

maxgro
MVP
MVP

pick(wildmatch(FIELD, 'B*', 'Y*', 'P*', 'F*', '*'),   '1','2','3','4','other') as NewField

Anonymous
Not applicable
Author

Thank you Massimo. Marked as helpful