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

Delete rows

Hello,

I've the following Table

Productname - Date1 - Partname - Date2

ProductA - 02.02.2013 - 25.02.2014   

ProductA - 02.02.2013  - 10.10.2016

ProductA - 21.08.2014 - 21.08.2014

ProductB - 05.05.2012 - 16.08.2016

ProductC  15.05.2012 - 29.03.2015

ProductC  15.05.2012 - 01.01.2014

But I only need the rows with the closest Date2 to Date1:

ProductA - 02.02.2013 - 25.02.2014    

ProductA - 21.08.2014 - 21.08.2014

ProductB - 05.05.2012 - 16.08.2016

roductC  15.05.2012 - 01.01.2014

Thankx

2 Replies
sunny_talwar

May be this

Table:

LOAD *,

  Date2 - Date1 as Diff;

LOAD * INLINE [

    Productname , Date1, Date2

    ProductA , 02.02.2013 , 25.02.2014 

    ProductA , 02.02.2013  , 10.10.2016

    ProductA , 21.08.2014 , 21.08.2014

    ProductB , 05.05.2012 , 16.08.2016

    ProductC,  15.05.2012 , 29.03.2015

    ProductC,  15.05.2012 , 01.01.2014

];

Right Join (Table)

LOAD Productname,

  Date1,

  Min(Diff) as Diff

Resident Table

Group By Productname, Date1;

Anonymous
Not applicable
Author

Sorry, for my late reply!

Thanks al lot! That's exactly what I needed.

Great!