Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
jamesjames
Contributor II
Contributor II

How to show top 5 in the table format?

Hi guys,

I am trying to create two tables, that shows top 5 payments. I have attached image, thus you can see what columns I am using with dummy date inside.

Tables I need:

1. TOP 5 incoming

2. TOP 5 outgoing

1.PNG

So far I tried 'aggr(if(rank(sum(AMOUNT))<=5,AMOUNT), PAYER_NAME)'

As you can see in the picture below it didn't sort from the highest to the smallest and also I am not sure how can I do for each 'outgoing' and 'incoming' separate?

2.PNG

 

What expression should I add, thus I have two separate tables that shows top 5 payments from highest to smallest and it also shows next to the amount 'PAYER_NAME'.

Is there also an option to number from from 1 to 5 ?

Thank you!

1 Solution

Accepted Solutions
Channa
Specialist III
Specialist III

bro the expression that i gave you it is not for measure..it should be dimension

 

ur measure Sum(Amount)

Channa

View solution in original post

4 Replies
Channa
Specialist III
Specialist III

=If(Aggr(Rank(Sum(Amount)),PAYER_NAME)<=5,PAYER_NAME)

 

try this

 

Channa
jamesjames
Contributor II
Contributor II
Author

Thank you for your reply.

If I use your expression it gives me outcome as seen in the image. (names instead number)

 

3.PNG

However, if I slightly adjust expression to =If(Aggr(Rank(Sum(AMOUNT)),AMOUNT)<=5,AMOUNT)

It gives me output like this:

4.PNG

It also gives me all payers.. how do I cut out rest of payers (so it is not showing) and also sort from highest to smallest and 

Channa
Specialist III
Specialist III

bro the expression that i gave you it is not for measure..it should be dimension

 

ur measure Sum(Amount)

Channa
jamesjames
Contributor II
Contributor II
Author

You're right, it works.