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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
cosmicyes
Contributor III
Contributor III

Load distinct according to two values

Hi,

this might not be too difficult but I cannot find out how to do this.

In a load-statement I want to just load the first record where the values "OrderNo" AND "Pos" are distinct.

Example:

OrderNo, Pos, pc, val
123,3,5,10
123,3,6,15

should only load the first record.

Thank you in advace for any hint.

Labels (1)
1 Solution

Accepted Solutions
Frank_Hartmann
Master II
Master II

try like this:

Temp:
Load * Inline [
OrderNo, Pos, pc, val
123,3,5,10
123,3,6,15
234,4,5,20
234,6,4,23
345,2,3,44
];

NoConcatenate

table1:
LOAD * Resident Temp
Where OrderNo<>Previous(OrderNo) and Pos<>Previous(Pos)
Order By OrderNo, Pos, pc, val;
DROP Table Temp;

View solution in original post

1 Reply
Frank_Hartmann
Master II
Master II

try like this:

Temp:
Load * Inline [
OrderNo, Pos, pc, val
123,3,5,10
123,3,6,15
234,4,5,20
234,6,4,23
345,2,3,44
];

NoConcatenate

table1:
LOAD * Resident Temp
Where OrderNo<>Previous(OrderNo) and Pos<>Previous(Pos)
Order By OrderNo, Pos, pc, val;
DROP Table Temp;