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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Max Value through firstsortedvalue function...

Hello Friends,

I have data as depicted in the following sample table:

For minimum of rate I have to display the maximum of purchase order. Thus for the above sample my result should be:

I tried using: FirstSortedValue(PURCHASE_ORDER,RATE).


It works when there is just 1 occurrence of minimum rate, but otherwise it results in null value. ( I have to accomplish this in front end, so no reload is possible).


Please suggest a solution.

1 Solution

Accepted Solutions
Not applicable
Author

Hi Friends,

I figured out the answer by hit and trial. For those who are interested:

FirstSortedValue(aggr(max(PURCHASE_ORDER),RATE), aggr(min(RATE),RATE))


View solution in original post

2 Replies
Not applicable
Author

Hi Friends,

I figured out the answer by hit and trial. For those who are interested:

FirstSortedValue(aggr(max(PURCHASE_ORDER),RATE), aggr(min(RATE),RATE))


Not applicable
Author

Added note:

If you have multiple material in he table then change the formula to:

FirstSortedValue(aggr(max(PURCHASE_ORDER),RATE,MATERIAL), aggr(min(RATE),CAL_RATE_P,MATERIAL)))