Skip to main content
Announcements
See why Qlik was named a Leader in the 2024 Gartner® Magic Quadrant™ for Data Integration Tools for the ninth year in a row: Get the report
cancel
Showing results for 
Search instead for 
Did you mean: 
karan_kn
Creator II
Creator II

Create a new field using multiple field values

Create a new field using multiple field values in the Load statement

 

IDField1Field2Field3
1A_Categ  
2 B_CategC_Categ
3  C_Categ
4A_Categ  
5 B_Categ 
6 B_Categ 
7A_Categ  
8  C_Categ
9A_Categ  
10 B_CategC_Categ

 

Ex result:

IDCombine field
1A_Categ
2B_Categ
2C_Categ
3C_Categ

 

 

4 Replies
Anil_Babu_Samineni

Perhaps this

Table:
CrossTable(Delete, [Combine field])
LOAD * FROM
[https://community.qlik.com/t5/New-to-Qlik-Sense/Create-a-new-field-using-multiple-field-values/m-p/1...]
(html, codepage is 1252, embedded labels, table is @1);

Final:
NoConcatenate
LOAD Distinct ID, [Combine field] Resident Table Where Len([Combine field])>0;

DROP Table Table;

Anil_Babu_Samineni_0-1610262674445.png

 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Vegar
MVP
MVP

Try using Crosstable () 

Crosstable (Field, [combined field], 1)

Load * from table ;

 

karan_kn
Creator II
Creator II
Author

Thanks for the response, Is it possible to create using If condition or something, instead of Crosstable, as I'm having more values in the columns to ignore, sorry I didn't mention in the sample data.

Ex:

If(Match(Field1,'A_Categ'), 'A_Categ',
If(Match(Field2,'B_Categ'),'B_Categ',
If(Match(Field3,'C_Categ'),'C_Categ')) as Test1

Anil_Babu_Samineni

When you say you have many, I won't prefer the If..Else condition as it is required in your requirement rather I would go CrossTable() only. If CrossTable() not required what you expect, you should explain little more where it fails

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful