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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get value in field X where max(field Y)

Hello,

i'm just getting started with Qlikview.

I was wondering how to add an expression to a textobject where the value has to come from field x where field y is the highest value.

I have something like this: =if(max(Y), X) but this doesn't work...

Thanks in advance

1 Solution

Accepted Solutions
tabletuner
Creator III
Creator III

Hi

In addition to Stephen's answer you have to be careful using FirstSortedValue if there are multiple records with the same highest Y value. You may want to use distinct as a keyword like:

=



FirstSortedValue(DISTINCT X,-Y)

Also note the minus sign before the Y field.

I assumed the following table:

XY
15
26
37
48
58


View solution in original post

4 Replies
stephencredmond
Partner - Specialist II
Partner - Specialist II

Hi,

You should be able to use FirstSortedValue for this. Y will need to be numeric.

Stephen

Not applicable
Author

You can try set analysis as well:

Fisrt create a variable as vMax=max(Y)

Then, the text object value can be =max({$<Y={$(vMax)}>} X)

tabletuner
Creator III
Creator III

Hi

In addition to Stephen's answer you have to be careful using FirstSortedValue if there are multiple records with the same highest Y value. You may want to use distinct as a keyword like:

=



FirstSortedValue(DISTINCT X,-Y)

Also note the minus sign before the Y field.

I assumed the following table:

XY
15
26
37
48
58


Not applicable
Author

Thanks a lot! It worked!

René