Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort Stacked Bar Chart by Total

Hey guys,

Sorry if this has been answered before, I couldn't find the answer related to Qlik Sense.

I want to sort my stacked bar chart by total stakced and limit it to top 10 based on this total (I can only limit to top 10 based on the first meausre). All titles in the graph below are sorted from the same field of Title so I thought that by sorting by expression Count(Title) would work but it didn't.

titles.PNG

My sort order is Active, Expired, Pending, Cancelled, [Dimension].

Thanks in advance if you guys can solve this issue!

1 Solution

Accepted Solutions
jyothish8807
Master II
Master II

And for top 10 try like this:

In your dimension, create a custom dimension:

=if(aggr(rank(sum(Active)+sum( Expired)+sum(Pending)+sum(Cancelled)),Dimension)<=10,Dimension)

Regards

KC

Best Regards,
KC

View solution in original post

6 Replies
jyothish8807
Master II
Master II

Hi james,

try like this:

In sort tab of your chart, write this in expression:

sum(Active)+sum( Expired)+sum(Pending)+sum(Cancelled)

Keep the sort order ascending

Regards

KC

Best Regards,
KC
jyothish8807
Master II
Master II

And for top 10 try like this:

In your dimension, create a custom dimension:

=if(aggr(rank(sum(Active)+sum( Expired)+sum(Pending)+sum(Cancelled)),Dimension)<=10,Dimension)

Regards

KC

Best Regards,
KC
Not applicable
Author

That solves half my problem, thanks Jyothish!

My other problem now is that I want to limit this to the top 10, but when I limit to a fixed number of 10 it only shows the top 10 for the first measure (which is Active). Is there any way I can make the 'calculated by measure' to show the top 10 of total?


Edit: Sorry I replied after you posted. I'll try that out.

Not applicable
Author

That's working awesome now thanks mate!

jyothish8807
Master II
Master II

You are welcome

Regards

KC

Best Regards,
KC
Not applicable
Author

Hi,

Understand this is a bit of an old post but didn't want to create a new one for a minor issue I am having with the above. I have tried using the following formula to order by stacked bar chart, however the order doesn't seem to have worked?

sum(AGED_CURRENT)+sum(AGED_30)+sum(AGED_60)+sum(AGED_90)+sum(AGED_OLDER)

Sorting issue.png

Could someone please help with this?

Many Thanks,

Nick