Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
DoubleG
Contributor II
Contributor II

Delete duplicates at specific field

Hey,

How can I get table without duplicate values at specific field??

Need delete duplicated rows ( second, third etc.) at id.apteki value field as like this picture (need delete red rows).

DoubleG_0-1692101028657.png

 

Labels (1)
1 Solution

Accepted Solutions
cristianj23a
Partner - Creator III
Partner - Creator III

Hello, use this code.

Create a test data where the dim field has duplicates in the "k" and "n" values.

Temp:
Load * Inline [
dim, Year,metric
a,2022,100
b,2022,110
c,2022,120
d,2022,130
e,2023,140
f,2022,150
g,2022,160
h,2022,170
i,2023,180
j,2022,190
k,2023,105
k,2023,109
n,2023,125
n,2023,164
];
 

NoConcatenate

Table:
Load Distinct dim as Dim,
firstvalue(Year) as Year,
     firstvalue(metric) as metric
Resident Temp Group By dim;
Drop Table Temp;
 
cristianj23a_1-1692113353035.png

 

Regarts.
 

 

https://www.linkedin.com/in/cristianjorge/
Do not forget to mark as "Accepted Solution" the comment that resolves the doubt.

View solution in original post

3 Replies
JHuis
Creator III
Creator III

What is you unique key?

DoubleG
Contributor II
Contributor II
Author

Good Question.
I can add additional field where duplicate number needed to delete ( no idea how flag ( 1 for unique value, 2... for duplicate value) to remove rows):

DoubleG_0-1692103214164.png

 

cristianj23a
Partner - Creator III
Partner - Creator III

Hello, use this code.

Create a test data where the dim field has duplicates in the "k" and "n" values.

Temp:
Load * Inline [
dim, Year,metric
a,2022,100
b,2022,110
c,2022,120
d,2022,130
e,2023,140
f,2022,150
g,2022,160
h,2022,170
i,2023,180
j,2022,190
k,2023,105
k,2023,109
n,2023,125
n,2023,164
];
 

NoConcatenate

Table:
Load Distinct dim as Dim,
firstvalue(Year) as Year,
     firstvalue(metric) as metric
Resident Temp Group By dim;
Drop Table Temp;
 
cristianj23a_1-1692113353035.png

 

Regarts.
 

 

https://www.linkedin.com/in/cristianjorge/
Do not forget to mark as "Accepted Solution" the comment that resolves the doubt.