Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
mschatt
Contributor
Contributor

Show record with max field value using aggregation

Hello Experts,

I have situation: I want to find record with max value of field "prediction sum". I am using the aggregation: aggr(max(prediction_sum),prediction_for). Field "prediction_for" has one value across the table. After aggregation I have one record, but value of the field "probability" is different than in source table. Why? (pic below)

problem.PNG

Thanks in advance

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Use calculated dimension like:

=Aggr(FirstSortedValue( probability,  -prediction_sum), prediction_for)

View solution in original post

6 Replies
tresesco
MVP
MVP

"probability" is a field or you are using some expression to create it?

MK_QSL
MVP
MVP

May be

FirstSortedValue(probability, aggr(max(prediction_sum),prediction_for)

mschatt
Contributor
Contributor
Author

Probability is a field. I am loading it form datasource.

tresesco
MVP
MVP

Try in your chart like:

FirstSortedValue( Aggr(probability, prediction_for), -aggr(prediction_sum, prediction_for))

if this doesn't work, try to share your sample qvw.

mschatt
Contributor
Contributor
Author

In attachment is an example qvw. I thought that when I use aggregation it will show the one record with max field and other fields related to this value. Something is missing?

tresesco
MVP
MVP

Use calculated dimension like:

=Aggr(FirstSortedValue( probability,  -prediction_sum), prediction_for)