Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rank Function need desired output

Hi

Help me out in getting desired output.  I am trying to get ranking to aggregated data. One expression is giving wrong output please find the yellow marked column in  output and expected output.

Output.PNG

 

Aggr(Sum([Value]), Agent,Comtype,POS,OD)

Aggr(FirstSortedValue(Name, -aggr(max(Value),Agent,Comtype,POS,OD,Name)), Agent,Comtype,POS,OD)

aggr(max(Value),Agent,Comtype,POS,OD)

Aggr(FirstSortedValue(Name, -aggr(max(Value,2),Agent,Comtype,POS,OD)), Agent,Comtype,POS,OD) (this is the expression

giving wrong output.

aggr(max(Value,2),Agent,Comtype,POS,OD)

Aggr(FirstSortedValue(Name, -aggr(max(Value,3),Agent,Comtype,POS,OD)), Agent,Comtype,POS,OD)

aggr(max(Value,3),Agent,Comtype,POS,OD)

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe

FirstSortedValue( Name, -aggr(Value, Agent,Comtype,POS,OD,Value,Name),2)

View solution in original post

8 Replies
MK_QSL
MVP
MVP

Your firstsortedvalue is looking wrong... use as below

FirstSortedValue(Name, -aggr(max(Value),Agent,Comtype,POS,OD,Name),2)

swuehl
MVP
MVP

If you want to stick with FirstSortedValue(), maybe like this:

=FirstSortedValue( Name, -aggr(sum(Value),Agent,Comtype,POS,OD,Name),2)

sunny_talwar

Hey Manish, I tried doing this, but it doesn't give correct output for two rows:

Capture.PNG

Capture.PNG

Is there a way to handle this with FirstSortedValue() still?

swuehl

Best,

Sunny

Not applicable
Author

Capture2.PNG

Thank You all ............Still getting error not getting desired output.

swuehl
MVP
MVP

Maybe

FirstSortedValue( Name, -aggr(Value, Agent,Comtype,POS,OD,Value,Name),2)

sunny_talwar

Awesome

Not applicable
Author

Excellent Bro ..........Thank You.

veidlburkhard
Creator III
Creator III

Hi shyamkb18,

sorry to say that, but for me it looks like your data is kind of contradictory:

AirIndia.jpg

e.g. for Agent B Business Class BLR with DEL-JP the name F1 has value 50 and 200 in week 1!?!

If you do the changes like this:
AirIndia2.jpg

Your original expression is working fine.

Regards

Burkhard