Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
richard_chilvers
Specialist
Specialist

GROUP LOAD 1st Record

I have a table of data:

CustomerIDOrderRefOrderDetailData1Data2
123443214321-1AB
123443214321-2CD
123443214321-3EF
123454325432-1ZX
234576547654-1WY
234576547654-2MN

I want to LOAD the first record (in full) based on the OrderDetail field, for each CustomerID/OrderRef group.

However there may be many Data fields (only 2 shown) so what is the best way of writing the LOAD ? I simply want to LOAD whatever values are on the first record of each group.

Thanks

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Try this:

Table:

LOAD CustomerID,

    OrderRef,

    OrderDetail,

    Data1,

    Data2

FROM

[https://community.qlik.com/thread/206446]

(html, codepage is 1252, embedded labels, table is @1)

Where Len(Trim(CustomerID)) > 0;

Right Join (Table)

LOAD CustomerID,

  FirstValue(OrderDetail) as OrderDetail

Resident Table

Group By CustomerID

Order By CustomerID, OrderDetail;

View solution in original post

2 Replies
sunny_talwar

Try this:

Table:

LOAD CustomerID,

    OrderRef,

    OrderDetail,

    Data1,

    Data2

FROM

[https://community.qlik.com/thread/206446]

(html, codepage is 1252, embedded labels, table is @1)

Where Len(Trim(CustomerID)) > 0;

Right Join (Table)

LOAD CustomerID,

  FirstValue(OrderDetail) as OrderDetail

Resident Table

Group By CustomerID

Order By CustomerID, OrderDetail;

richard_chilvers
Specialist
Specialist
Author

Thanks !