Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
New-Qlik
Creator II
Creator II

Combine fields into one row

Hi,

I have a requirement to combine a columns data into on row as below example i.e UK and US country should come in same row for ID 3

Thanks in Advance

    
IDNamecountry 
1aaSweden 
2bbDenmark 
3aaUS 
3aaUK 
4ccUS 
4ddUK 
    
    
IDNamecountry 
1aaSweden 
2bbDenmark 
3aaUS, UK 
4ccUS 
4ddUK 
    
8 Replies
PrashantSangle

try below

Temp:
Load ID,Concat(DISTINCT Name,',') as NewName, Concat(country,',') as newCountry
Group By ID;
Load * Inline [
ID, Name, country
1, aa, Sweden
2, bb, Denmark
3, aa, US
3, aa, UK
4, cc, US
4, dd, UK
];

Regards,
Prashant Sangle
Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
tresesco
MVP
MVP

Use concat()
raman_rastogi
Partner - Creator III
Partner - Creator III

Use Concat() Function

T1:
Load * Inline [
ID, Name, country
1, aa, Sweden
2, bb, Denmark
3, aa, US
3, aa, UK
4, cc, US
4, dd, UK];

Load ID,Name,Concat(country,',')as Country Resident T1 Group by ID, Name;
Drop Table T1;

New-Qlik
Creator II
Creator II
Author

In my model country is coming from different table .  joining them n doing concat is not a good idea. 

New-Qlik
Creator II
Creator II
Author

creating concat(country) as measure gives below result

 

IDNamecountry
total Sweden,Denmark,US,UK
1aaSweden
2bbDenmark
3aaUS
3aaUK
4ccUS
4ddUK
New-Qlik
Creator II
Creator II
Author

Hi Shubham,

I didn't get what exactly your are doing for my issue. 

Shubham_Deshmukh
Specialist
Specialist

You only want it for ID =3 ?
If not, just refer that whole thread, you will get an idea. Same issue mentioned in that thread.