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: 
subbareddykm
Creator II
Creator II

grouping

I have requirement like below :

For Company Code=A and Code=Code1 , I want top 5 Age values in my Age Field irrespective of my expression:

For Above case top 5 Ages are :   

39
35
31
27
19

For Company Code=B and Code=Code2 , I want top 5 Age values in my Age Field irrespective of my expression:

For Above case top 5 Ages are : 

   

87
86
83
79
75

Could you please help here , how to do it ?

4 Replies
settu_periasamy
Master III
Master III

Try this.

=Sum({<Age={"=aggr(rank(sum(Age)), Company,Age)<=5"}>}Val)

shiveshsingh
Master
Master

Hi Try this

=Sum({<Emp={"=aggr(rank(sum(Age)),Company,Age)<=5"}>}Age)

subbareddykm
Creator II
Creator II
Author

Its is not working in app, for all Company Code, For some company's not coming top 5 when I select any company and Code then it is working

Is it possible to create it in Script level ?

shiveshsingh
Master
Master

Have you tried this?

=Sum({<Emp={"=aggr(rank(sum(Age)),Company,Age)<=5"}>}Age)