Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Avoid duplicates

I have two fields id and Product for example

id product

1    a

2    b

3    a

3    b

4    a

4    b

I should get

1 a

2 b

3 a

4 a

id should be uniqe and product should be lowest

Please help me

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

You can do it by using FirstValue and Group By clause

Sample:

Load * inline [

id ,product

1    ,a

2    ,b

3    ,a

3    ,b

4    ,a

4   , b];

DistinctProductList:

Load id, FirstValue(product) As DistinctProduct

Resident

Sample

Group By id;

Drop Table Sample;

Hope this helps

View solution in original post

2 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

You can do it by using FirstValue and Group By clause

Sample:

Load * inline [

id ,product

1    ,a

2    ,b

3    ,a

3    ,b

4    ,a

4   , b];

DistinctProductList:

Load id, FirstValue(product) As DistinctProduct

Resident

Sample

Group By id;

Drop Table Sample;

Hope this helps

MayilVahanan

HI

Please find attachment.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.