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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
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

Labels (1)
1 Reply
Miguel_Angel_Baeyens
Support
Support

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