Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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
Honored Contributor III

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

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

3 Replies
shraddha_g
Honored Contributor III

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

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

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

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
Honored Contributor III

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

Ohh yes.

Thank you for correction.

Community Browser