Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Partner
Partner

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
Highlighted
Master III
Master III

Hi,

maybe & instead of +

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

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

Regards,

Antonio

Highlighted
Specialist III
Specialist III

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

Highlighted
Partner
Partner

I think you're looking for soemthing like this:

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

View solution in original post

Highlighted
Master
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"

Highlighted
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')


Highlighted
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

Highlighted
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!

Highlighted
Creator II
Creator II

Hi,

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

Highlighted
Partner
Partner

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]