Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On Demand Webinar: See Why Thousands of QlikView Users Have Switched to Qlik Sense. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
nayanqlik
Partner
Partner

2nd most highest value

Hi

I want to create a an expression in the front end , that points to the 2nd last value

So for example, in the simple list of dates below, I want to create say, Sum (Sales), but it where date = 20/03/2018

               Date                     Sales

17/01/2018                      20
14/02/2018                     40
20/03/2018                    10
06/04/2018                    90

How do i do this?

Kind regards

Nayan

8 Replies
sunny_talwar

May be this

FirstSortedValue(Aggr(Sum(Sales), Date), -Date, 2)

nayanqlik
Partner
Partner

Thank you Sunny for the quick response.  Will try and let you know.

Kind regards

Nayan

nayanqlik
Partner
Partner

Hi Sunny

Doesn't work out, not sure where I'm going wrong.  If I just want to show the value in the date field only, so in my case , 20/03/2018

sunny_talwar

Show in date field? Not sure I understand?... would you be able to elaborate?

nayanqlik
Partner
Partner

Hi

I had a relook at my model and ignore my logic above.   I'll resend you my query.

Kind regards

Nayan

jonathandienst

How about:

=Max(Date, 2)

or

=Date(Max(Date, 2))

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
qv_testing
Specialist II
Specialist II

Try this..

=Date(Max(Date, 2),'DD/MM/YYYY')

or

=FirstSortedValue(Date, -Date, 2)

nayanqlik
Partner
Partner

Hi All

Thank you all for your reply.  I need to relook at the script.  I thought looking at the 2nd most highlest value would solve the actual issue I'm having.

If I get a solution, will share.

Kind regards

Nayan