Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! 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"

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

I think you're looking for soemthing like this:

if([Brand]='ss' or [Brand]='sp' or [Brand]='sm','samsung'

View solution in original post

18 Replies
antoniotiman
Master III
Master III

Hi,

maybe & instead of +

'ss'&'sp'&'sm' -> ssspsm.

However i'm not sure this is what You need.

Regards,

Antonio

sergio0592
Specialist III
Specialist III

What is the expected meaning or using + ?? Is it if ([Brand]= 'ss' or 'sp' or 'sm', 'Samsung', 'Others') ?

stigchel
Partner - Master
Partner - Master

I think you're looking for soemthing like this:

if([Brand]='ss' or [Brand]='sp' or [Brand]='sm','samsung'

ahaahaaha
Partner - Master
Partner - Master

Hi,

Try

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

effinty2112
Master
Master

Hi Madhu

try:

Pick(Match(Brand, 'so','lg','ss','sp','sm'),'sony','lg','samsung','samsung','samsung')


Edit: to take care of 'Other'


Pick(1+Match(Brand, 'so','lg','ss','sp','sm'),'other','sony','lg','samsung','samsung','samsung')


jmvilaplanap
Specialist
Specialist

Hi, Madhu

I think you must to split the values of "Samsung", you mus to write this

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


Regards

juan_patrick
Creator
Creator

Hi Mafhu!


Try this:


if (match([Brand],'so'), 'sony',

    if(match([Brand]='lg'), 'lg',

       if(match([Brand], 'ss', 'sp', 'sm'),'samsung', 'Other'))) as "Brand name"


¡Good luck!

madhuqliklondon
Creator II
Creator II
Author

Hi,

where ever in that field it says 'ss' or 'sp' or 'sm' they should go under 'samsung'.

stigchel
Partner - Master
Partner - Master

Instead of the nested if's it would be better practice to use a map for this:

Map:

Mapping Load * Inline [From, To

'so', 'sony'

'lg', 'lg'

'ss','samsung'

'sp','samsung'

'sm','samsung'

];

And then where you load the brand field use

Applymap('Map',BrandField,'Other') as [Brand name]