Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort Order of Stacked Bar Chart

Dear All,

I've created Stacked Bar Charts and been trying to find a way in which I want to sort the charts.

I have some office branches on the dimension axis and sales amount of each branch on the expression axis. The total sales amount consists of product A, B, C, D which are expresed in percentages. (The total becomes 100%)

Is there a way to sort this chart in order by the value of A, B, C or D of descending?

1 Solution

Accepted Solutions
Not applicable
Author

Hi OGA,

the formula has to be:


=aggr(sum({$ <Product={A}>}Sales),Branch, Product)/sum(TOTAL<Branch>Sales)+aggr(sum({$ <Product={B}>}Sales),Branch, Product)/sum(TOTAL<Branch>Sales)


Have Fun

Alex:)

View solution in original post

6 Replies
Not applicable
Author

You want to sort the Stacked Bar chart according to the Product A,B,Cor D. You can go to the Chart Properties and then the Sort tab , Select the Expression and write the expression with which you want to sort it.

Not applicable
Author

Hi Silky

Thanks for your response. You are right, but I want to know the correct way of expression to sort it....

Not applicable
Author

Ok.. can u post the sample data here so that i can guide you in a better way....!!

or you can try with the same expression that you have used for the Chart.....see if that works !!

Not applicable
Author

Wow, you've changed your pic.

Anyway, I attached a sample of qvw file. Also, I post below an image of the chart which I would like to make.

Not applicable
Author

Hi OGA,

the formula has to be:


=aggr(sum({$ <Product={A}>}Sales),Branch, Product)/sum(TOTAL<Branch>Sales)+aggr(sum({$ <Product={B}>}Sales),Branch, Product)/sum(TOTAL<Branch>Sales)


Have Fun

Alex:)

Not applicable
Author

Hi Alex,

It worked!!!! This is a great help. I really appreciate it!!!

And this makes me have another question..

Can this formula be applicable to other stacked bar charts? In this case, I have to write product name A and B in the formula and not applicable to other charts whichi don't includes A nor B...

I guess it would be possible if I use some variables,,,, but I wonder how...