4 Replies Latest reply on Nov 16, 2016 9:10 AM by Dick Holm

    Displaying negatives in Treemap

    Roy Weckiewicz

      I have a question which probably has a simple answer, but I've not yet been able to find a solution on the forums or the net. I'm trying to map about 24k rows of data onto a treemap, and the data points range between ~ -25k and 25k. I'm sizing and coloring the treemap panels with a delta calculation between the two years on the 'Range of dates' slider. The calculation appears to be working correctly, and nulls are checked for and avoided in the calculation. The problem is that my negative values are never displayed - All I get is the notification that X number of values are negative. The color legend (red-blue diverging) shows my negative values, and the underlying data is bringing in the negatives. Tableau gives the option to display the absolute value of these, but this would not place them correctly in my map.

       

      Any ideas? This is using the latest 9.3.x (64-bit).

        • 1. Re: Displaying negatives in Treemap
          David Li

          Hi Roy, this is a fundamental problem of this kind of area chart--it can't display negatives. Here are a couple options that come to mind of how you can get around this:

          1. Use another chart type. Bars, perhaps?
          2. Create a calculation that takes the absolute value of your measure, use that for the Size mark, and then create a calculation that indicates whether the measure is negative or positive. Then, you can either color the different signs different colors or, better yet, put the positive/negative calculation on rows and separate them into two separate tree charts.
          1 of 1 people found this helpful
          • 2. Re: Displaying negatives in Treemap
            Roy Weckiewicz

            Hi David,

             

            As to your first suggestion: my bosses are quite keen on the treemap for this particular set of data, so changing the graph type would not really be an option.

             

            As for your second suggestion: I will give this a try and see how it looks. Would the placement of the treemap tiles still be correct? Currently the most positive delta goes in the top left. I wouldn't want for example, a value of 4000 and abs(-3950) to be adjacent albeit with different colors. Two separate charts is an interesting idea - I will give this a try as well. I misspoke in my post - it's the result of the calculation that has the negative to positive range, not the original data set, but that's irrelevant here I think.

             

            Thank you for the suggestions!

            • 3. Re: Displaying negatives in Treemap
              David Li

              Happy to help! If you were to just color the tiles based on the sign without doing anything else, then the placement would not be correct.

              • 4. Re: Displaying negatives in Treemap
                Dick Holm

                Two Calculated Fields and one setting in Edit Color enables the use of diverging colors and negative values in Treemaps.  Workbook is available on Tableau Public, hover over marks to see positive and negative values.

                 

                The strategy: Find the minimum of the Measure and use its absolute value as an offset.  Create a Calculated Field that shifts all values by adding the offset, place it on Color.  Create another field which is the absolute value of the original, place it on Size.  Set Color:Center to the offset.  Show the original (unaltered) Measure in Tooltip.

                 

                Using Sample Superstore.xlsx:

                1. Find Min(Profit)

                Min(Profit).PNG

                2.  Create 2 calculated fields:

                Profit(abs).PNG

                Profit + 6600.PNG

                3. Place Pills on Marks card as shown below.

                Pills on Marks Card.PNG

                4. Edit Colors  set Center to the offset (6,600).

                Edit Colors.PNG

                5. Set Tooltip to show original values.

                Tooltip.PNG

                6. You get this.

                Treemap with negative values.PNG