Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to create a new column by using the the existing column

Hi team,

I have a field called status which contains the code from 1 to 10.

i need to create a new column called group based on these codes.

if code is 1 or 2 then it should be new

if code is 3 to 5 it should be old

if code is other then above then it should be NA

can you help me to achieve this.

thanks

7 Replies
Anonymous
Not applicable
Author

Hi,

try with:

LOAD *, if(code<3, 'new', if(code<6, 'old', 'NA')) as groupcode

FROM yoursource;

Marc

Anonymous
Not applicable
Author

Try something like this.

LOAD

     code

     if(code >=1 and code <= 2, 'New', if(code >=3 and code <=5, 'OLD', 'NA'))

Resident your_table

Regards,

Gabriel

ali_hijazi
Partner - Master II
Partner - Master II

load * , if (code <3, 'new', if(code <6 , 'old', 'n/a')) as groupcdoe resident your_table

drop your_table

I can walk on water when it freezes
Anonymous
Not applicable
Author

Hi,

Simple if caluse will work.

if(code >=1 and code <= 2, 'New', if(code >=3 and code <=5, 'OLD', 'NA'))


BR,

Chinna

Not applicable
Author

thank you, i got it

Not applicable
Author

thanks

Not applicable
Author

thank you