Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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;
Sorry, for my late reply!
Thanks al lot! That's exactly what I needed.
Great!