Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
Partner
Partner

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
Highlighted
Partner
Partner

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

Highlighted
Not applicable

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")

Highlighted
Partner
Partner

Ohh yes.

Thank you for correction.