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

top 3 Values in text box

hi All,

i want a text box with top 3 values from my data based on the the expression:

Category  ID
Plan A      1

Plan A      2

Plan A      3

Plan A      4

Plan B      5

Plan B      6

Plan C      7

Plan D     8

Plan D      9

Plan D      10

Plan E      11

so basd on the expression count(distinct ID)

i want a text box stating:

Top 3 plan for this month are:Plan A,Plan D and Plan B.

1 Solution

Accepted Solutions
maxgro
MVP
MVP

='Top 3 plan for this month are: ' & chr(10) &

concat(if(aggr(Rank(count(DISTINCT ID)),Category)<=3,Category),'   ')

1.jpg

View solution in original post

4 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

='Top 3 plan for this month are: ' & only({<Category={'=rank(count(ID))=1'}>}Category) & ', ' &

only({<Category={'=rank(count(ID))=2'}>}Category) & ' and ' &

only({<Category={'=rank(count(ID))=3'}>}Category)


talk is cheap, supply exceeds demand
maxgro
MVP
MVP

='Top 3 plan for this month are: ' & chr(10) &

concat(if(aggr(Rank(count(DISTINCT ID)),Category)<=3,Category),'   ')

1.jpg

saurabh5
Creator II
Creator II
Author

thanks Massimo & Gysbert.

I had one more question using the expression of your i am able to get what i want but is there a possibility that we can place and between second and third category. Using the Expression provided I am able to do the same but if there are 2 Categories having same count on top 3 then it doesnt give any output.

Regards

Saurabh

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I had one more question using the expression of your i am able to get what i want but is there a possibility that we can place and between second and third category.

The 'and' between the second and third category is why I posted my expression instead of using concat like Massimo did.


talk is cheap, supply exceeds demand