Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
sunitha_chellaiah
Partner - Creator
Partner - Creator

To show only first record in straight table

Hi All,

I want to show only first record in straight table

eg: My data has multiple line numbers against multiple PO numbers. Output should show only the first line number against each PO number. 

PO               Line Number

16100                1

16100                2

16100                3

16200                2

16200                3

15300                4

15300                5

Output should be:

PO               Line Number

16100                1

16200                2

15300                4

Please give front end solution.

Thanks.

 

 

 

2 Replies
sergio0592
Specialist III
Specialist III

Hi,

Should work with :

TABLE1:
LOAD *

INLINE [
PO ,Line_Number
16100  ,1
16100  ,2
16100  ,3
16200  ,2
16200  ,3
15300  ,  4
15300  ,  5]
;

TABLE2:
LOAD min(Line_Number),PO
resident TABLE1
GROUP BY PO;

DROP TABLE TABLE;

maohob1
Contributor
Contributor

You must use the FirstValue function.
Try using this code.

LineNumberTable:
LOAD * INLINE [

PO , LineNumber
16100 , 1
16100 , 2
16100 , 3
16200 , 2
16200 , 3
15300 , 4
15300 , 5
];


FirstValueTable:
LOAD
PO as new_PO ,
FirstValue( LineNumber) as new_LineNumber
Resident LineNumberTable
Group By PO ;

DROP Table LineNumberTable;