2 Replies Latest reply on Sep 29, 2016 5:07 AM by Bill McQueen

    Formatting an Area Chart with Negative Values

    Bill McQueen

      I have a data set that includes several accounts broken down into Debts and Assets, along with their Net Values by month.  I put these into a stacked area chart to help visualize the growth of the assets compared to the reduction of debts.  The positive (Asset) side of the graph looks exactly the way I intended, but the negative (Debt) side has several problems that I cannot figure out how to fix:

       

      1.  Whenever a Debt reached $0, Tableau draws a vertical line from that Account to the X-axis (0).  How do I get rid of these lines, and why do they not show up on the positive values?

       

      2.   On the Asset (positive) side, when funds are transferred between accounts, the two shaded areas fit together like puzzle pieces.  On the Debt (negative) side, there is a gap between accounts when this happens, which may be a result of the lines mentioned above.  How do I get rid of that gap?

       

      Screenshot and .twbx are attached.

       

      Capture.JPG

        • 1. Re: Formatting an Area Chart with Negative Values
          Wesley Magee

          Bill,

          The primary reason you're getting those lines and gaps is because your data includes 0's. One approach to fix the problem would be to create a new calc for Net Value that excludes 0's. It would look like this:

           

          If Sum([Net Value]) > 0 Then Sum([Net Value])

          ELSEIF Sum([Net Value]) < 0 Then Sum([Net Value])

          END

           

          You'll see that there are still a couple of small gaps, which I'm not entirely sure why they are present but I'll let you know if I can find a remedy.

          -Wesley

          2 of 2 people found this helpful
          • 2. Re: Formatting an Area Chart with Negative Values
            Bill McQueen

            Thank you, Wesley!

             

            I created the calc field, and the lines were removed, but there were still gaps, as you mentioned.  BUT... it also gave me an alert of NULLS present in my data.  When I clicked on the alert and selected "Show Data At Default Position," it removed the gaps as well.

             

            This got me exactly the result that I was looking for.