Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
vdcastro
Partner - Contributor III
Partner - Contributor III

aggr firstsortedvalue

Hello everyone,

i am trying to create a graph with the firstsortedvalue with aggr but with no sucess.

I have this dataset:

CiOPiEn
-EP1E1
-EP2E2
-EP8E3
-EP8E4
-EP8E5
-EP2E6
-EP9E7
C1CP1-
C2CP8-
C3CP1-
C5CP8-

i want to know the Ci with max (count(Pi with most En))

C5 - 3

C2 - 3

C3 - 2

C1 - 1

I tried:

=max( aggr( count({<O = {'E'}>} En), Pi )) gives me the number 3. It's correct but i want de Ci instead of the sum value.

=sum(Aggr(FirstSortedValue(count({<O = {'E'}>} En), Pi), Ci))   gives me 0 instead of C5. I dont know where i am failling.

can anyone help me how to get the correct expression?

Greetings

11 Replies
Kushal_Chawda

hahaha ...tujse kam great hu:)

vdcastro
Partner - Contributor III
Partner - Contributor III
Author

Thanks a lot stalwar1 and kush141087.

Both solutions work.

However i can't change the script. It must be done with set analysis.

I learned a lot with your answers.

Thank you very much for you help and time.

Greetings