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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

group values

Hi,

I need to group values into a new filed to summarize them.

I was thinking about using function IF

the aim is to have

FIELD A= 1 or 2 or 3   FIELD B= 100

FIELD B= 4 or 5 or 6   FIELD B= 200

FIELD C= 7 or 8 or 9   FIELD B= 300

and sons...

I tried with this script but it seems to reach just the first input of each class

If (FIELD A='1' or '2' or '3', '100', If (FIELD A='4' or '5' or '6', '200', If (FIELD A='7' or '8' or '9', '300','N/A'))) as "FIELD B"

I suppose something is missing in the syntax but I don't know what!

thanks in advance

1 Solution

Accepted Solutions
Sokkorn
Master
Master

Hi,

Maybe this one can help you:

If(MATCH(FIELD A,'1','2','3'), '100',

   If (MATCH(FIELD A,'4','5','6'), '200',

     If (MATHC(FIELD A,'7','8','9', '300'),'N/A'))) as [FIELD B]

Regards,

Sokkorn Cheav

View solution in original post

2 Replies
julian_ortiz
Partner - Contributor III
Partner - Contributor III

Hi Pastrana

Try this

If (FIELD A='1' or A='2' or A='3', '100', If (FIELD A='4' or A='5' or A='6', '200', If (FIELD A='7' or A='8' or A='9', '300','N/A'))) as "FIELD B"

Regards

Julian

Sokkorn
Master
Master

Hi,

Maybe this one can help you:

If(MATCH(FIELD A,'1','2','3'), '100',

   If (MATCH(FIELD A,'4','5','6'), '200',

     If (MATHC(FIELD A,'7','8','9', '300'),'N/A'))) as [FIELD B]

Regards,

Sokkorn Cheav