Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sljn
Contributor
Contributor

How do I rank customers based on sales amount by using a button?

Hi! 

I'm trying to use a button to easily select the top 10 customers based on sum of sales amount. 

I've already managed to create a ranking for the pivot table based on sales. 

I've used below as a function for the button but it doesn't work. It doesn't rank correctly for some reason. 

='('& concat (if(aggr(rank(sum([Sales Amount])),Customer) <= 5, Customer), '|') & ')

Any suggestions on what to do? 

Labels (3)
7 Replies
AR_Gonza_2107
Contributor II
Contributor II

Did you try making that button just a value to limit the dimension on your chart? 

Sljn
Contributor
Contributor
Author

How do you mean? 

AR_Gonza_2107
Contributor II
Contributor II

As you are able to limit the dimension value on a chart (Pivot table I
guess on your case), you can use a variable to select the top 10 values for
example based on your expression on the table; so, if in your dimension
limit you put the variable with the value that you set on a button, it
should work.
Sljn
Contributor
Contributor
Author

Thank you for the reply! 

I get how I can limit the dimension ,customer, to top 10 values by using limitations. 

I started to use qliksense today, so I can you give me little more guidance on how to link it to the button?

Sljn
Contributor
Contributor
Author

I've realised that the problem is the seperator. It only returns customer names without space in between, 

Do you know how I can use a separator that returns names with spaces in between using the above syntax? 

AR_Gonza_2107
Contributor II
Contributor II

Could you try with this?

aggr(if(rank(sum([Sales Amount]))<=5,Customer),Customer)
 
Keep in mind that the AGGR function gives you a virtual table that you can use as a dimension; so with this, is no longer needed to limit the dimension on your chart.
 
I hope this is useful for you.
AR_Gonza_2107
Contributor II
Contributor II

Did it work? Don't forget to change the status of your question and confirm if you get a solution to share with the community 🙂