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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Removing duplicates on load

I need help.  I have a table that houses a product name, a delivery date and other information.  Lets use this for an example.  This would be my table.

ProductDelivery DateDescription
1June 1Carton
1June 2Box
2June 3Material
3June 4Screws
1June 5Nails

I want to load my table where it only shows distinct items for the Product column.  Essentially I need it to load only showing one item from the "Product" column showing the soonest delivery date and remove all duplicate lines bases on the Product column.  Once it's loaded I'll create a chart and it should look like this,

ProductDelivery DateDescription
1June 1Carton
2June 3Material
3June 4Screws

Thanks for the help!!

1 Solution

Accepted Solutions
Not applicable
Author

I would do somthing like that :

LOAD

Product

minstring(Delivery Date) AS Delivery Date

minstring(Description) AS Description

Group by Product

From YourSource;

(Check  the minstring function actually works, I have never used it)

View solution in original post

4 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

If your source table is already sorted by date you can use this:

Load Product, [Delivery Date], Description

from somewhere

where not exists Product;

Alternatively you can try this:

load

     Product,

     min([Delivery Date]) as [Delivery Date],

     firstsortedvalue(Description, [Delivery Date]) as Description

from somewhere

group by Product;


talk is cheap, supply exceeds demand
Not applicable
Author

I would do somthing like that :

LOAD

Product

minstring(Delivery Date) AS Delivery Date

minstring(Description) AS Description

Group by Product

From YourSource;

(Check  the minstring function actually works, I have never used it)

Not applicable
Author

try this

load Product ,

min(date(date#([Delivery Date],'MMM D'),'MMM D')) AS [Delivery Date],

FirstSortedValue(Description,date(date#([Delivery Date],'MMM D'),'MMM D') )AS Description1

group by Product;

tab1:

LOAD Distinct * INLINE [

    Product, Delivery Date, Description

    1, June 1, Carton

    1, June 2, Box

    2, June 3, Material

    3, June 4, Screws

    1, June 5, Nails

];

then output like this

ProductDescription1[Delivery Date]
1CartonJun 1
2MaterialJun 3
3ScrewsJun 4
Not applicable
Author

Thanks guys.  This is the final code that worked for me.

LOAD Text3,

     minstring(Start_Date) as Start_Date2

FROM

(biff, embedded labels, table is Task_Table1$)

//where Text3 = 'CARC00912';

group by Text3;