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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Ruud_Hogenboom
Contributor II
Contributor II

Create a new column based on the values of multiple other columns

I would like to create a new column to my data using the Qlik Sense editor. Based on the values in columns A:C i want to get the results in column D.

Ruud_Hogenboom_0-1603720121031.png

I used the following formula for it in excel:

=IF(A2="F56";"F56";IF(A2="F57";"F57";IF(AND(A2="F60";C2=4);"SKD";IF(AND(A2="F60";B2<>"phev";C2=1);"F60";IF(AND(A2="F60";B2="PHEV";C2=1);"F60_PHEV";IF(A2="F48";"F48";""))))))

 

Is this also possible in Qlik Sense?

1 Solution

Accepted Solutions
Taoufiq_Zarra

@Ruud_Hogenboom like :

if(CITY='F56' or CITY='F57' or CITY='F48' ,CITY,if(CITY='F60' and PRDGRP=4,'SKD',if(CITY='F60' and FUEL<>'phev' and PRDGRP=1,'F60',if(CITY='F60' and FUEL='phev' and PRDGRP=1,'F60_PHEV',''))))
 as New_CITY

example :

Data:

Load *,if(CITY='F56' or CITY='F57' or CITY='F48' ,CITY,if(CITY='F60' and PRDGRP=4,'SKD',if(CITY='F60' and FUEL<>'phev' and PRDGRP=1,'F60',if(CITY='F60' and FUEL='phev' and PRDGRP=1,'F60_PHEV',''))))
 as New_CITY inline [
CITY,FUEL,PRDGRP
F56,petrol,1
F57,diesel,1
F60,petrol,1
F60,diesel,1
F60,phev,1
F60,petrol,4
F48,petrol,1
];

 

output:

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

2 Replies
Taoufiq_Zarra

@Ruud_Hogenboom like :

if(CITY='F56' or CITY='F57' or CITY='F48' ,CITY,if(CITY='F60' and PRDGRP=4,'SKD',if(CITY='F60' and FUEL<>'phev' and PRDGRP=1,'F60',if(CITY='F60' and FUEL='phev' and PRDGRP=1,'F60_PHEV',''))))
 as New_CITY

example :

Data:

Load *,if(CITY='F56' or CITY='F57' or CITY='F48' ,CITY,if(CITY='F60' and PRDGRP=4,'SKD',if(CITY='F60' and FUEL<>'phev' and PRDGRP=1,'F60',if(CITY='F60' and FUEL='phev' and PRDGRP=1,'F60_PHEV',''))))
 as New_CITY inline [
CITY,FUEL,PRDGRP
F56,petrol,1
F57,diesel,1
F60,petrol,1
F60,diesel,1
F60,phev,1
F60,petrol,4
F48,petrol,1
];

 

output:

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Ruud_Hogenboom
Contributor II
Contributor II
Author

Hi Taoufiq,

Thank you for your response.

That did the trick.  Thank you very much.