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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Find distinct Values in a cell

Hi all,

I have this table

Names
George, George, John, Chris
Helen, John
John, John, John,John

and i want to create a new column with this output

Output
George, John, Chris
Helen, John
John

any ideas?

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

You can do it like this (first splitting the field value into parts, then re-combining using a distinct concat):

Names:

LOAD Concat(DISTINCT Name,',') as Names

GROUP BY RecID;

LOAD recno() as RecID, Trim(SubField(Names,',')) as Name;

LOAD * INLINE [

Names

"George, George, John, Chris"

"Helen, John"

"John, John, John,John"

];

View solution in original post

2 Replies
swuehl
Champion III
Champion III

You can do it like this (first splitting the field value into parts, then re-combining using a distinct concat):

Names:

LOAD Concat(DISTINCT Name,',') as Names

GROUP BY RecID;

LOAD recno() as RecID, Trim(SubField(Names,',')) as Name;

LOAD * INLINE [

Names

"George, George, John, Chris"

"Helen, John"

"John, John, John,John"

];

tamilarasu
Champion
Champion

Hi,

Try this,

Data:

Load Names, Trim(SubField(Names, ',')) as TempField;

LOAD * INLINE [

    Names

    "George, George, John, Chris"

    "Helen, John"

    "John, John, John,John"

];

Final:

LOAD Names,

    Concat(Distinct TempField, ',') as NamesNew

Resident Data

Group by Names;

Drop Table Data;

Untitled.png