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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
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

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

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
MVP
MVP

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