Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to obtain the latest 2 dates from a list of dates

I am using Qliksense 3.0. I have an excel sheet containing data arranged according to dates in the format MM/DD/YYYY. How can I extract the latest 2 dates from this list? For example, when my data is arranged like this :

NoTest DateMachine ConfigTest TypeTest StreamTotal DatasetsFailures
103/24/2016xxxxxxxxx123415
204/07/2016xxxxxxxxx567810
308/09/2016xxxxxxxxx90311
410/09/2016xxxxxxxxx25550
511/17/2016xxxxxxxxx987830

The statement :

LOAD

    Date(max("Test Date")) as MaxDate

Results in MaxDate => 11/17/2016

But how do I get the last 2 latest dates, i.e in this case 11/17/2016 and 10/09/2016 ?

Any help is appreciated!

1 Solution

Accepted Solutions
shraddha_g
Partner - Master III
Partner - Master III

Try:

LOAD

    Date(max("Test Date")) as MaxDate

From Excel;

Load

Date(max("Test Date")) as MaxDate2

From Excel

where not exists(MaxDate,Test Date")

View solution in original post

3 Replies
shraddha_g
Partner - Master III
Partner - Master III

Try:

LOAD

    Date(max("Test Date")) as MaxDate

From Excel;

Load

Date(max("Test Date")) as MaxDate2

From Excel

where not exists(MaxDate,Test Date")

Not applicable
Author

Awesome Shraddha, this works. Thanks much!

The opening quote was missing, that's the only change needed in your statement, i.e


where not exists(MaxDate,"Test Date")

shraddha_g
Partner - Master III
Partner - Master III

Ohh yes.

Thank you for correction.