Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to Pull top 5 when there is a tie

stalwar1‌,

My question is to solve no 2) below. But first I want distincguish betn 1) & 2)

1) old post (qvw attached: "Rank_sort_1")

I was able to pull top 5 by using  Count({ < FieldA = {'1'}, Rank ={'<= 5'}>} ID) [Rank is derived from your script]. This qvw has data at ID level granularity.

Indiv_rows.PNG

2) New post (qvw attached: "Rank_sort_2") This qvw already has count per vendor aggregated represented by the field [Regular count].

another diff is it does not have [FieldA] because the that req is already met. with avail data, how can I pull Top 5 vendor from ABC to ABCC but not ABEE  in a pivot table keeping Group and vendor in dimensions.

Aggr_rows.PNG

Thank you again for your generous description and continuous support. much appreciated.

1 Solution

Accepted Solutions
sunny_talwar

10 Replies
Anonymous
Not applicable
Author

sunny_talwar

Like this?

Capture.PNG

Anonymous
Not applicable
Author

yes this works in this sample. checking in my app.

sunny_talwar

Sure thing

Anonymous
Not applicable
Author

it should have worked. its pulling only 1 Group with correct results. I must have messed something

sunny_talwar

Can you try checking Always Fully Expanded on the properties tab?

Anonymous
Not applicable
Author

yes it was because of that. I have that option checked and its pulling top 5 the way I want it. I am trying to show total count for each Group; tried show partial sum for Group and/or vendor but no success

sunny_talwar

Try this expression:

=Count(Aggr(Only({<Rank = {'<=5'}>}Count), Group, Vendor))


Capture.PNG

Anonymous
Not applicable
Author

aggr1.PNG

it is counting the number of vendor occurrences in the table. I tried Sum(Aggr(Only({<Rank = {'<=5'}>}Count), Group, Vendor)) and it worked! Thank you so much sunny for sharing your genius and generosity. I am one lucky Qlikker