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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

FirstSortedValue - return the max value...

Hi all

I am trying to use the FirstSortedValue function - which I think is the correct function to use in my case, but am not able to achieve the correct result. In the example below I am trying to return the latest OrderDate for the max sales date, but based on the max sale value.

As there are three order dates with the same max value of Sale (19.6) without using the 'DISTINCT' syntax the firstsortedvalue does not return a result. However as shown in the yellow box below I wish to return the date of 10/01/2016 (the most recent date that is associated with the max sale amount)  and not the OrderDate of 05/01/2016.

Any ideas are most welcome!

Thanks!

FSV.png !

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

May be try this:

=FirstSortedValue(DISTINCT OrderDate,-(Sale*100000+OrderDate))


Capture.PNG

View solution in original post

2 Replies
sunny_talwar

May be try this:

=FirstSortedValue(DISTINCT OrderDate,-(Sale*100000+OrderDate))


Capture.PNG

tresB
Champion III
Champion III

='Max OrderDate:

FirstSortedValue(DISTINCT OrderDate,Sale): ' & Date(Max({<Sale={"$(=Max(Sale))"}>}OrderDate))