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

Merge rows

The data:


ID, SEQ, NAME
1,1,A
1,2,A
1,3,A
1,4,A
1,5,A
2,1,B
2,2,B
2,3,B
2,4,B


Is it possible to merge the rows with same ID together following the sequence column? The result should be something like this:


ID, MergedName
1, A1A2A3A4A5
2, B1B2B3B4


12 Replies
johnw
Champion III
Champion III

The concat() function already supports giving it a sequence, so there's no need for additional steps for the sort.

LOAD ID,concat(NAME,'',SEQ) as NAME
INLINE [
ID, SEQ, NAME
1,1,AA
1,2,AB
1,3,AC
1,4,AD
1,5,AE
2,4,BD
2,3,BC
2,2,BB
2,1,BA
]
GROUP BY ID;

Not applicable
Author

Hi tauqueer,

I tried this method, but for some unknown reason, it doesn't work correctly for my real data. The merged result is still not in the sequential format.

Not applicable
Author

I edited Karl's script a bit and it is working fine now! Big Smile Thanks Karl for the code!

Thanks to all for all the suggestions!