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: 
Not applicable

How to get unique / distinct rows?

Hi,

Let's say I have the following 3 fields loaded from a file with many others:

IDXY
110a
210b
310c
45d
55e
65f

7

5g
85h
915i
1015j
1120k
1220l
1320m
1420n
1525o
1625p

For each distinct value of 'X' I would like to take only one of it's corresponding IDs (no matter which). Furthermore, I would like to keep the table above loaded as it is (with all of it's values).

1 Solution

Accepted Solutions
robert_mika
Master III
Master III

t1:

LOAD ID,

     X,

     Y

FROM

[163430.xlsm]

(ooxml, embedded labels, table is Sheet1);

t2:

LOAD Min(ID),

  X as x

from

[163430.xlsm]

(ooxml, embedded labels, table is Sheet1)

group by  X

11-May-15 9-52-42 AM.jpg

View solution in original post

3 Replies
robert_mika
Master III
Master III

t1:

LOAD ID,

     X,

     Y

FROM

[163430.xlsm]

(ooxml, embedded labels, table is Sheet1);

t2:

LOAD Min(ID),

  X as x

from

[163430.xlsm]

(ooxml, embedded labels, table is Sheet1)

group by  X

11-May-15 9-52-42 AM.jpg

anbu1984
Master III
Master III

T1:
Load * Inline [
ID,X,Y
1,10,a
2,10,b
3,10,c
4,5,d
5,5,e
6,5,f
7,5,g
8,5,h
9,15,i
10,15,j
11,20,k
12,20,l
13,20,m
14,20,n
15,25,o
16,25,p ]
;

T2:
Load X,Max(ID) as ID1 Resident T1 Group By X;

Not applicable
Author

Thank you for your quick and appropriate answers. I already used what Robert Mika suggested at first and it was very helpful. Thank you anbu cheliyan for your cooperation as well