Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Woojtek_96
Contributor III
Contributor III

Show duplicate value within one field

Hi all,

I have a question, how to check if I have duplicate value within one field.

For example:

Raport_table_tmp:
load
Raport_ResNo,
Raport_PersonOnResNo,
Raport_ServiceCode,
Resident ResTable

and i want to check if particular Person on reservation has duplicates in Raport_ServiceCode value, if yes load them if not make a null().

Can i do it with script? I dont want to make it in front with set analysis becouse of many rows of table

Testing scenario

ResNoPersonOnResServiceCode
1111Service1
1111Service1
1112Service1
1112Service2
1113Service 1

and i want to load only person who has duplicated service code (in case this is person number one) and concat those services into one row in column (on front)

1 Solution

Accepted Solutions
edwin
Master II
Master II

you can aggregate it something like:

 

tmp: load PersonRes, ServiceCode, count(ServiceCode) as cnt resident DATA group by PersonRes, ServiceCOde;

nonconcatenate NewData: load PersonRes, ServiceCode resident tmp where cnt>1;  drop table tmp

this last table gives you the Person,ServiceCode that are multiple.  you can left join or inner join it to your original table depending on what you need.


 

View solution in original post

1 Reply
edwin
Master II
Master II

you can aggregate it something like:

 

tmp: load PersonRes, ServiceCode, count(ServiceCode) as cnt resident DATA group by PersonRes, ServiceCOde;

nonconcatenate NewData: load PersonRes, ServiceCode resident tmp where cnt>1;  drop table tmp

this last table gives you the Person,ServiceCode that are multiple.  you can left join or inner join it to your original table depending on what you need.