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: 
CHRIS_Singa
Creator
Creator

Getting only distinct val inside the cell

Hello,

I got one question about getting the distinct value inside the cell

As you can see from the image, I would like to get only :

DT-PT 

PT 

I want to avoid the repeat value. The solution must be in the script editor please.

Thank you in advance 

Labels (5)
2 Replies
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Not sure about combinations you may have in your data.. but something like that could work:

,If(CODE_DEMI_TRAITEMENT like '*DT*' and CODE_DEMI_TRAITEMENT like '*PT*','DT-PT',
		If(CODE_DEMI_TRAITEMENT like '*DT*' and not CODE_DEMI_TRAITEMENT like '*PT*','DT',
		If(CODE_DEMI_TRAITEMENT like '*PT*' and not CODE_DEMI_TRAITEMENT like '*DT*','PT','OTHER'
		))) as [your distinct field]

 

cheers

cheers Lech, 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 to the problem.
Chanty4u
MVP
MVP

Try something like this 

CleanedTable:

LOAD 

    Checkb1,

    Concat(DISTINCT SubField(CODE_DEMI_TRAITEMENT, '-', IterNo()), '-') as CODE_DEMI_TRAITEMENT_CLEAN

Resident RawTable

While IterNo() <= SubStringCount(CODE_DEMI_TRAITEMENT, '-')+1

Group By Checkb1;