Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
manojkulkarni
Partner - Specialist II
Partner - Specialist II

Pick latest 2 dates

Good Morning to all,

I need to get latest 2 date fields during load to process another statement. How can we achieve this during load of QVD.

Is there any function or way to get only latest 'N' dates from a QVD. BELOW is the sample with expected result

eg:

I have following data

01/12/2014

15/12/2014

31/12/2014

01/01/2015

31/01/2015

expected result

31/12/2014

31/01/2015

1 Reply
Miguel_Angel_Baeyens

Hi Manoj,

It should be something like

Date:
LOAD Date, Year(Date) AS Year INLINE [  

Date 

01/12/2014 

15/12/2014 

31/12/2014 

01/01/2015 

31/01/2015 

]

MaxDatesPerYear:
LOAD Year, Date(Max(Date)) AS SelectedDate
RESIDENT Date
GROUP BY Year;

DROP TABLE Date;

Miguel

EDIT: Reviewed code