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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
madhuqliklondon
Creator II
Creator II

Using + in If function

I am trying to divide the column data into filter value can I use + with if example: can  I use the following script??

if ([Brand]='so', 'sony', if([Brand]='lg', 'lg',if([Brand]='ss'+'sp'+'sm','samsung', 'Other'))) as "Brand name"

18 Replies
madhuqliklondon
Creator II
Creator II
Author

there is small issue which I forgot , there is a another column where they made in ‘made in’  for LG

I want only  ‘made in’  ‘UK’ or ‘EU’ for brands remaining it’s fine. For now this is my script

if ([Brand]='so', 'sony', if([Brand]='lg', 'lg',if([Brand]='ss' Or [Brand]='sp' Or[Brand]='sm','samsung', 'Other'))) as "Brand name"

I want to use ‘match’ ’made in’ UK or EU if([brand]=’lg’ ,’lg’. 

jmvilaplanap
Specialist
Specialist

Hi

You can add this new condition to the line, comparing the "country" column. For example

if(Brand = 'sm' and Country='UK', 'samsung', 'Other') as "Brand name"

effinty2112
Master
Master

Hi Madhu,

try

Pick(1+Match(Brand,'lg'),'UK','EU')

EDIT: Misread your message and got things backward

Pick(1+Match(Brand,'lg'),'EU','UK')

madhuqliklondon
Creator II
Creator II
Author

Hi,

is' made in' column name is not required in script?

effinty2112
Master
Master

Hi,

If you have a chart with dimension Brand then

Pick(1+Match(Brand,'lg'),'EU','UK')

will work as an expression.

Putting it in the script instead does makes sense. Then you'll have [Made In] as a dimension in your data model.

cheers

Andrew

madhuqliklondon
Creator II
Creator II
Author

Hi Andrew,

I am writing this in script level.

stigchel
Partner - Master
Partner - Master

If I understand you correctly that would be

if ([Brand]='so', 'sony', if([Brand]='lg' and ([made in]='UK' or [made in]='EU'), 'lg',if([Brand]='ss' Or [Brand]='sp' Or[Brand]='sm','samsung', 'Other'))) as "Brand name"

madhuqliklondon
Creator II
Creator II
Author

Hi,

Is match is not required???

stigchel
Partner - Master
Partner - Master

That depends on the contents of the [made in] field, I don't know your data and/or data model. The = operator will only be true for exact matches, if [made in] is for example a concatenated string of countries you could use

WildMatch([made in],'*EU*','*UK*')>0