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: 
david_pearson
Contributor III
Contributor III

Count top 10 from table

Hi All

I have a problem I cant quite sort and wonder if anyone can help.

I have a table looking at top ten based on the "cause description". The cause desc has been restricted to display the top 10 in the Qlik table using “Fixed Number”. I can see the correct top 10 however when I apply a count to field "CLAIMNO" I get the wrong total. The total imgetting is actually all the CLAIMNO in the full table rather than just the top 10 displayed.

Any thoughts or suggestion/answers would be great 😏

I had merely applied count(CLAIMNO) initially which obviously hasnt worked.

thanks 

Labels (1)
1 Solution

Accepted Solutions
david_pearson
Contributor III
Contributor III
Author

got it. 

the dimension 

"=IF(Aggr(Rank(SUM(CLAIMNO),4),CAUSE DESCRIPTION)<=10,CAUSE DESCRIPTION)"

then Expression "= Count(CLAIMNO)"

View solution in original post

9 Replies
Anil_Babu_Samineni

Perhaps this?

count({<[Cause Description] = {"$(=Aggr(Rank(Count(CLAIMNO))<11, [Cause Description]))"}>} CLAIMNO)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
david_pearson
Contributor III
Contributor III
Author

thanks for the reply. this puts a 0 in all the cells for this column 😞

Anil_Babu_Samineni

Perhaps this?

Calculate Dimension:

=IF(Aggr(Rank(Count(CLAIMNO),[Cause Description])<=10,[Cause Description])

Or

Expression:

SUM({<[Cause Description] = {"=Rank(Count(CLAIMNO))<=10"}>}CLAIMNO)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
david_pearson
Contributor III
Contributor III
Author

it would need to be an expression as im wanting to count the vol of CLAIMNO. the problem with the

"SUM({<[Cause Description] = {"=Rank(Count(CLAIMNO))<=10"}>}CLAIMNO)"

is that the CLAIMNO field is numeric. therefore when i want to count 2 claimno below i would expect the output to be 2 however with your cover i would get 234234 as it sums the fields together.

CLAIMNO

123123

111111

Anil_Babu_Samineni

What is returning using that expression?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
david_pearson
Contributor III
Contributor III
Author

got it. 

the dimension 

"=IF(Aggr(Rank(SUM(CLAIMNO),4),CAUSE DESCRIPTION)<=10,CAUSE DESCRIPTION)"

then Expression "= Count(CLAIMNO)"

david_pearson
Contributor III
Contributor III
Author

@Anil_Babu_Samineni, now that the initial problem has been sorted i have another one. using this new total i want to get a % split for each cause description. i would normally doe count(claimno)/count(total claimno) however this is still taking the overall total (761) of the table rather than the expected 648.

any suggestions?

thanks 

 
Anil_Babu_Samineni

Perhaps this?

count(claimno)/count(total <Description> claimno)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
david_pearson
Contributor III
Contributor III
Author

unfortunately not. this gives the below as a percentage. it just, for example, doing 177/177 rather than 177/648

clipboard_image_0.png