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: 
patbuchanan
Contributor III
Contributor III

Sort Stacked Chart by Y and 2nd Dimension

I've been asked to create a stacked chart to sort by Grand Total and then in each bar to sort the values from High to Low.  When it displays all of the choices it doesn't sort High to Low for each bar but if I click on just one Location then it sorts properly, just not when all data is displayed.  I saw some examples show aggr but when I tried that with my data still no luck...  I've attached a sample file.

All Data-Not Sorted Properly.JPG

Notice Location 7 along with others are not sorted High to Low

Filter 1 Location-Sorts Properly.JPG

But if I click just on Location 7 then it does sort the data properly...

1 Solution

Accepted Solutions
MarcoWedel

Hi,

maybe one solution could be:

QlikCommunity_Thread_181828_Pic1.JPG

QlikCommunity_Thread_181828_Pic2.JPG

QlikCommunity_Thread_181828_Pic3.JPG

QlikCommunity_Thread_181828_Pic5.JPG

QlikCommunity_Thread_181828_Pic4.JPG

QlikCommunity_Thread_181828_Pic6.JPG

hope this helps

regards

Marco

View solution in original post

8 Replies
cjohnson
Partner - Creator II
Partner - Creator II

Hi Pat,

Please change your sort columns to the following:

image15.png

Additionally, I noticed that your expression doesn't have any kind of aggregation around it sum(), avg() etc. Please use either the sum or only function to get your KPI's...If you have more than one value per Location GRBS combination Qlikview won't know what to do with it.

See attached for more details.

Thanks,

Camile

maxgro
MVP
MVP

like this? see attachment

1.png

patbuchanan
Contributor III
Contributor III
Author

I've tried that but still doesn't sort properly as a whole.  Below is an image of your option.  They want me to sort each Location from High to Low by sum of Total field.

All Data-Not Sorted Properly2.JPG

Anonymous
Not applicable

use the following sort Option

but the last two Locations are not quite correct

by the way: as you see there is a red line after max(Total)

I renamed Total to Total1 in your script and the red line was gone

Total is a reserved word, so try to avoid These reserved words

patbuchanan
Contributor III
Contributor III
Author

This is pretty close but the legend on each bar uses different colors and list the items in the legend many times with the different colors.  Looks like I need to use this along with some color formatting.

MarcoWedel

Hi,

maybe one solution could be:

QlikCommunity_Thread_181828_Pic1.JPG

QlikCommunity_Thread_181828_Pic2.JPG

QlikCommunity_Thread_181828_Pic3.JPG

QlikCommunity_Thread_181828_Pic5.JPG

QlikCommunity_Thread_181828_Pic4.JPG

QlikCommunity_Thread_181828_Pic6.JPG

hope this helps

regards

Marco

patbuchanan
Contributor III
Contributor III
Author

Thanks a lot this appears to do the trick.

Not applicable

The palette of colors is limited, in this case if we have more than 50 GRBS ! the colors is repeated so there is a way to stretch so as to have a plenty of colors?

Your help is very appreciated!