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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out 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

Labels (1)
2 Replies
sunny_talwar
MVP
MVP

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!