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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
siddharth_kulka
Creator II
Creator II

Sort and Concatenate

Hi,

Hoping for steer on below requirement:

Check all values in the 6 digit SSN field. If any 5 of the 6 digits match then concatenate using any delimiter else do not concatenate.

In below example,

5 SSN digits match for ID's 1,2. Also all SSN 6 digits match for IDs 2,4 (order not relevant).

Hence, rows need to be concatenated for both fields. 

Data
SSNID
0123451
3216542
1445433
1234564

 

Expected Output
  
SSNID
012345|321654|1234561|2|4
1445433

 

Any help would be welcome. Thanks in adv

Labels (2)
2 Replies
sunny_talwar
MVP
MVP

144543 have all six digits matching with 012345

Saravanan_Desingh
MVP
MVP

Can you check this?

tab1:
LOAD SSN, ID, Concat(Tuple,'',Col) As Pat
Group By SSN, ID
;
LOAD *, If(Index(SSN,IterNo()-1)>0,IterNo()-1,'X') As Tuple, IterNo()-1 As Col
While IterNo()<=10
;
LOAD SSN-0 As SSN, ID INLINE [
    SSN, ID
    012345, 1
    321654, 2
    144543, 3
    123456, 4
];

commQV32.PNG