Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

dmelillo
Contributor II

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

Re: If Statement Where Field Begins With ...

Try this may be:

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

assuming you were using % for wild card

3 Replies

Re: If Statement Where Field Begins With ...

Try this may be:

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

assuming you were using % for wild card

MVP
MVP

Re: If Statement Where Field Begins With ...

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

dmelillo
Contributor II

Re: If Statement Where Field Begins With ...

Thank you Massimo. Marked as helpful

Community Browser