Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

saurabh5
Contributor 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 areSmiley Tonguelan A,Plan D and Plan B.

1 Solution

Accepted Solutions
MVP
MVP

Re: top 3 Values in text box

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

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

1.jpg

4 Replies

Re: top 3 Values in text box

='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
MVP
MVP

Re: top 3 Values in text box

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

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

1.jpg

saurabh5
Contributor II

Re: top 3 Values in text box

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

Re: top 3 Values in text box

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