Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Interactive Chart - Unpredictable sorting behaviour when creating stacked bar chart

Hannah_Lissaman
11 - Bolide

I am trying to create a stacked bar chart with a specific sort order for the Y axis categories. I use a sort tool to get my data into the correct order, which works fine for a simple bar chart. Then when I add a split to create the stacked bars, it reorders the bars, seemingly at random, which makes the sort order meaningless.

 

I have attached a reproduction of this issue with the sample data - it only occurs if I have quite a few categories on the axis. Note that there is a difference between the order after the Sort tool and in the chart. 

 

I have had the same behaviour in 2018.3 and 2019.1. 

4 REPLIES 4
kelly_gilbert
13 - Pulsar

Hi, @Hannah_Lissaman - some Categories (Y axis) don't have values for all of the Customer Segments (colors). For example, 101GOLDEN doesn't have a value for Consumer, so it's getting sorted after all of the Categories that do have a Consumer value.

You could do something like this, where you force the chart input to have every possible combination of Customer Segement and Category:

kelly_gilbert_0-1594675755687.png


New output:

kelly_gilbert_1-1594675818741.png

...

CharlieS
17 - Castor
17 - Castor

Nice work @kelly_gilbert!

 

It should be noted that this solves it in newer version like 2019.2+, but not 2018.3. I don't have a 2019.1 install readily available, so I can't test to see if 2019.1 and 2019.2 have the same order. I recall a bunch of updates for the Interactive Chart tool during the time of these releases, so I guess something in there got this logic sorted out. 

Hannah_Lissaman
11 - Bolide

Thank you so much @kelly_gilbert! You have saved a lot of stress and manual adjustments.

 

Based on a quick test, this does seem to solve the problem in both 2019.1 and 2018.3, although have not tried out in anger yet. 

oly
Alteryx Alumni (Retired)

Thanks @kelly_gilbert 

Great approach! For some reason you definitely need a Cartesian for all categories/splits as well as either on of those below:

 

a) sorting or

b) additional numeric variable by category (but not segment) and then applying sorting in the Insight Chart parameters by that new variable. In that last scenario you can change order ascending/descending and don't need to pre-sort data before the insight.

Labels