Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a table where Names are getting repeated. I want to pull all those repeating names in a separate table. How should I that?
So My table is,
Name | Country | Unit | System |
---|---|---|---|
Ran Pitt | SA | electric | pu |
Jack Mou | PA | engine | mo |
Ran Pitt | SA | thermal | tg |
Shriy Sharma | AA | hydro | tg |
Ran Pitt | NA | electric | pu |
Jack Mou | PA | engine | gf |
Honey Singh | WI | hydro | ba |
After pulling duplicate records, output should be
Name | Country | Unit | System |
---|---|---|---|
Ran Pitt | SA | electri | pu |
Ran Pitt | SA | thermal | tg |
Ran Pitt | NA | electric | pu |
Jack Mou | PA | engine | mo |
Jack Mou | PA | engine | gf |
Many thanks in advance ❤️
Maybe like
Table:
LOAD Name,
Country,
Unit,
System
FROM
[https://community.qlik.com/thread/292316]
(html, codepage is 1252, embedded labels, table is @1);
Right JOIN
LOAD Name
WHERE Count>1;
LOAD Count(Name) as Count, Name
Resident Table
GROUP BY Name;
I really appreciate your help, but somehow it is not working.
I did this way also, but still no luck.
Table:
LOAD Name,
Country,
Unit,
System
FROM
xyz;
Table1:
Load *,
If((Count(Name)>1),'Repeated', 'Non-Repeated') as Repeaters
Resident Table
Group By Name;
Drop table Table;
Please suggest.
The code I've posted should work as requested, I get this result:
Name | Country | System | Unit |
---|---|---|---|
Ran Pitt | NA | pu | electric |
Jack Mou | PA | gf | engine |
Jack Mou | PA | mo | engine |
Ran Pitt | SA | pu | electric |
Ran Pitt | SA | tg | thermal |
Your code is not executing because you need to either aggregate the fields in your second table load or add them to the GROUP BY clause.
Guess this is what you want to do instead (replacing your second LOAD):
Table1:
LEFT JOIN (Table)
Load Name,
If((Count(Name)>1),'Repeated', 'Non-Repeated') as Repeaters
Resident Table
Group By Name;
Name | Country | System | Unit | Repeaters |
---|---|---|---|---|
Honey Singh | WI | ba | hydro | Non-Repeated |
Jack Mou | PA | gf | engine | Repeated |
Jack Mou | PA | mo | engine | Repeated |
Ran Pitt | NA | pu | electric | Repeated |
Ran Pitt | SA | pu | electric | Repeated |
Ran Pitt | SA | tg | thermal | Repeated |
Shriy Sharma | AA | tg | hydro | Non-Repeated |