5 Replies Latest reply on Jul 27, 2016 5:38 AM by Peter Seok

    Sorting Stacked Bar Chart by Totals

    Peter Seok

      Hi Everyone,

       

      Another quick question on sorting stacked bar charts.  I have everything pretty well setup, but there's just one thing that's not functionally working as far as I can see.  I'm trying to sort each level of my hierarchy by the total count of issues that I have, and I've already selected the descending option based on the count of issue rating.

       

      However, in the workbook I've attached, you can see that Harold Reynolds and Eduardo Mensana, each have 2 issues, but they're showing up in the middle of the pack under Donna Simpson in the Analysis and Planning section.

       

      I've played around with all the sort options, and I still can't get this to work properly, any idea on what I'm doing wrong?  Thanks very much for your help!

        • 1. Re: Sorting Stacked Bar Chart by Totals
          Ben Neville

          Hi Peter - this is a common issue, as what Tableau sorts on is the actual field you selected to sort. If it appears multiple times in the chart, it is counted as a single entity.

           

          If this is not the desired sorting functionality, the best option is usually to create a combined field of all of the fields you want Tableau to consider in your sort, then place this combined field at the front of your rows, and sort on it. You can then hide it to remove the duplicate info. Check out the attached workbook.

          • 2. Re: Sorting Stacked Bar Chart by Totals
            Peter Seok

            Hi Ben,

             

            Thanks for coming back so quickly!  I took a look at your example, and I tried your suggestion on the combined field, the only problem is, I lose the grouping functionality, I still need it tiered by Director, Bank Group, Manager, Employee, is there something I'm missing?

             

            Otherwise yes, it looks like I can sort on the combined field, and that gives me a straight descending list from top to bottom (but with no grouping).

            • 3. Re: Sorting Stacked Bar Chart by Totals
              Michael Hesser

              Hi Peter;

              I'll be watching this intensely! I've had the same problem, specifically figuring out which level of a hierarchy is active. Once we have that, we can calculate to our heart's content!

               

              There were some Active Level hacks I saw before, but I don't think these work any more (please correct me if I am wrong!).

               

              In my somewhat-similar case, I had to give up on the intuitive of the hierarchy and go with a parameter for view level: my calculations were based off of that (and yes, it got messy!).

               

              You (and others reading this) may want to consider upvoting this idea or ones similar:

              https://community.tableau.com/ideas/4255#comment-20709

              • 4. Re: Sorting Stacked Bar Chart by Totals
                Ben Neville

                Hi Peter - if you still want to retain the grouping, you should be fine - just take that combined field, and place it between Manager and Employee on your rows shelf, then sort as before. Hide the field to fix the clutter, but this should be what you want.

                 

                Again, it all comes down to understanding Tableau's sorting - if you sort on a field, Tableau sorts the members of that field, not every occurrence of every member. If you want it to take into account every occurrence, you just need to sort on a field that uniquely identifies the occurrences - in this case, the combined field.

                 

                Hope that helps.

                • 5. Re: Sorting Stacked Bar Chart by Totals
                  Peter Seok

                  Hi Ben,

                   

                  Thanks very much for your help, this gets me much closer.  I've placed the combined field where you've specified, and it retains the grouping as I need it.  Quick question, how do I hide the field?  As far as I can see, I can only hide individual rows, I've clicked around, but I don't see any option to hide an entire field/column.