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

Aggr function in set analysis

Hello:

in a table like this:

campo1  campo2  valore

A             10         1

A               3       99

A             27         3

B             14         1

B             32         2

C           100         6

C           200         7

C           300       14

I want in a graph obtain for every value in campo1 the value of valore for the minimum of campo2, in this example I want to obtain this:

A  99

B   1

C   6

I tried a graph/pivot with campo1 as dimension and sum({$<campo2={$(=min(aggr(min(campo2),campo1)))}>}valore) as expression but also

sum({$<campo2={$(=aggr(min(campo2),campo1))}>}valore). But In first case I get only 99 and 0 for other campo1 values, in second case I get 0 and a value only if I select only one value of campo1.

Can someone help me please?

1 Solution

Accepted Solutions
Not applicable
Author

Something like this:

campo1 as dimension

=aggr(if(campo2=min(total <campo1> campo2),valore),campo1,campo2)

You could put sum in front of it b ut it wouldn't matter unless there are 2+ rows with the same campo1 and campo2, the campo2 is the min for that campo1, and the valore is different.

View solution in original post

2 Replies
Not applicable
Author

Something like this:

campo1 as dimension

=aggr(if(campo2=min(total <campo1> campo2),valore),campo1,campo2)

You could put sum in front of it b ut it wouldn't matter unless there are 2+ rows with the same campo1 and campo2, the campo2 is the min for that campo1, and the valore is different.

Not applicable
Author

It works! Thank you

Enrico