Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
MBokan
Contributor

Show both the top- and bottom five values in a bar chart

Hello, I am very new to using qlik so please bare with me.

I am trying to show both, in my example, the top five sales people and bottom five sales people based on their sales, in the same chart.

I understand I can show the top five values by using the limitations-function, but how can I show both the top-and bottom five values in the same chart?

Thanks!

Labels (1)
  • Chart

1 Solution

Accepted Solutions
hanna_choi
Partner - Creator

Hello MBokan

How about you have 2 measures?

First is top 5 and secondary is bottom 5.
if you have 2 measures, the chart does not display zero dimensions.

Top 5 : Sum({<[Sales Rep Number] = {"=Rank(Sum(Sales))<=5"}>} Sales)

Bottom 5 : Sum({<[Sales Rep Number] = {"=Rank(-Sum(Sales))<=5"}>} Sales)

The presentation is Stacked bars.

top bottom.png

 

Best Regard

Hanna.choi

View solution in original post

5 Replies
Gabbar
Specialist

You will need to use if like this:-
If(Rank(Sum(Sales)) < 6 or Rank(-Sum(Sales)) < 6, Sum(Sales),Null()
)

After that Uncheck Include Null values to get you answer.
(Please set you rank function and measure according to your requirement)

MBokan
Contributor
Author

Thank you for your reply!

When I tried the if statement which you presented, all values which were between the top 5 and bottom 5 ended up being zero, and therefore there were more values in the bottom than there should be.

MBokan_0-1703518417053.png

 

When I checked for the result manually, I could see that there are only five sales people which have zero sales.

MBokan_1-1703518432251.png

 

 

Again, thank you for the reply!

hanna_choi
Partner - Creator

Hello MBokan

How about you have 2 measures?

First is top 5 and secondary is bottom 5.
if you have 2 measures, the chart does not display zero dimensions.

Top 5 : Sum({<[Sales Rep Number] = {"=Rank(Sum(Sales))<=5"}>} Sales)

Bottom 5 : Sum({<[Sales Rep Number] = {"=Rank(-Sum(Sales))<=5"}>} Sales)

The presentation is Stacked bars.

top bottom.png

 

Best Regard

Hanna.choi

Gabbar
Specialist

Can you share a sample of your data?
also do you want the bottom 5 of those people who have done sales or does zero work?

anat
Master

you can try using Rank function

aggr(if(rank(sum(Revenue))<=10 or rank(-sum(Revenue))<=10,Customer),Customer)