4 Replies Latest reply on Apr 13, 2016 2:43 PM by Joshua Milligan

    Rank for Treemap Bars

    Joshua Preston

      Treemap Bars provide a lot of detail in one view. I'd like to do a *simple* rank of the bars in the view, but I can't.


      Scenario: The rows are the universities. The treemaps within the bars are the number of research papers (Detail) and category of research papers (Color). Any attempt at a simple Index Rank doesn't work. A rank of "#1" is all that displays and computing along different options doesn't work (see before and after screenshot). Also note that MIT (and maybe other universities) loses a few bars when rank is placed in row shelf.


      Any help to produce a rank that works and preserves original view would be much appreciated. (workbook attached).


        • 1. Re: Rank for Treemap Bars
          KK Molugu



          At a high level it looks like the Rank is not computing using properly. Did you try selecting the down arrow on the Rank pill and select compute using Subtype1.. See the attached image.. Not sure if you are expecting the ranks to change instead of 1 for all



          Screen Shot 2016-04-12 at 8.28.54 AM.png


          • 2. Re: Rank for Treemap Bars
            Joshua Milligan



            Rank is a little tricky here because of the aggregation and the fact that the data is sparse (not every Institution has every Subtype or Title and not every Subtype has every Title).  In previous version of Tableau, before the Rank() function existed, we had to use Index() to make our own Rank.  And I suspect that will be the easiest solution here.


            As you are able to sort Institution1 the way you'd like, you can then use Index() to simply increment the rows like this:




            The trick is to not let any fields be the partition -- so right click the Index field and select Edit Table Calculation...

            Then use the drop down option for Compute using: and select Advanced....


            Set it up with all fields in Addressing in the order shown below:



            and after clicking OK, set the At the level: option to Institution1





            What this does is tell Tableau not to partition Index by anything, but to calculate the Index at the level of Institution.



            Hope that helps!


            Best Regards,


            • 3. Re: Rank for Treemap Bars
              Joshua Preston

              JM - Thank you for the the solution and the quick reply. This worked like a charm! I was able to replicate the results no problem. Thanks for the screen shots and walkthrough. I'll be using ranks like this regularly so it will be a key part of my workflow. Cheers!

              • 4. Re: Rank for Treemap Bars
                Joshua Milligan

                You’re welcome!  I’m glad it worked!