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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
guruprem
Partner - Creator III
Partner - Creator III

Logic help requited to categerise string feild

Hi,

I have [Customer Name] , which has individual customer names , now I would like write a logic for [Customer Group ]says that if [Customer Name] contains walmart then  Group should be Walnmart, if it contains target then Group should be Target and so on.

Please suggest me the best approach for this logic.

1 Solution

Accepted Solutions
maxgro
MVP
MVP

pick(WildMatch([Customer Name], '*WALMART*', '*TARGET*', '*'),    'Walmart', 'Target', 'Other')

View solution in original post

3 Replies
JonnyPoole
Former Employee
Former Employee

Wildmatch() will leverage strings and wild cards and do a case insensitive search to find the right bucketing

if(  wildmatch([Customer Name]),'*WALMART*','Walmart',

     if( wildmatch([Customer Name] ,'*TARGET*','Target')

)

Are these buckets mutually exclusive or could some include both walmart and target ?

crystles
Partner - Creator III
Partner - Creator III

if(wildmatch( [Customer Name],'*walmart*') =1, 'Walmart,

     if(wildmatch( [Customer Name],'*target*')=1, 'Target,

                    )) as CustomerGroup

This should work. You can add as many Groups as you want with the same formula.

maxgro
MVP
MVP

pick(WildMatch([Customer Name], '*WALMART*', '*TARGET*', '*'),    'Walmart', 'Target', 'Other')