5 Replies Latest reply on May 19, 2016 7:12 AM by Johan Undra

    Incremental Stacked Bar Chart

    Johan Undra

      Hi everyone

       

      I hope this question (actually, its two questions... sorry ^^) is not out of scope.

       

      Currently I have an amount of results and differences:

      stacked_bar_chart_differences.png

      I would like to do the following: I would like to create a Stacked Bar Chart that shows the incremental differences to the previous values beginning on the height of the previous column so that it just grows. Is this possible somehow?

       

      I thought about maybe having the previous value as an additional bar below the differences that could maybe be coloured black/white. Or maybe there is a native way to do so. Any help is appreciated.

       

      The other thing is, I am calculating the differences to the previous based on Number of Records and a Lookup, but it separates between the marks I have set for "Kunde". Is there a way to calculated the sum of both without removing it (then it works of course)?

       

       

       

      Thanks a lot in advance

        • 1. Re: Incremental Stacked Bar Chart
          Stephane Marx

          Hi Johan,

          The calculation you would need to use is:

          ZN(SUM([Number of Records])) - LOOKUP(ZN(SUM([Number of Records])), -1)

          But you can actually do everything without creating a calculation, simply by using tableau table calculations. Here is how:

          create a bar chart with your number of records and duplicate the it with crtl+ click:

          Edit the second measure "sum of record" > right click > add table calc > difference

          Then right click again on  the second measure "sum of record" > edit table calculation > choose "advanced" in the drop down option in "calculate the difference along"

          In advanced option choose to partition from category (your dimension) addressing month of order date (what's in your column)

          Regarding the coloring simply remove the dimension color from the marke card on the second chart:

          It should work.

          Please mark useful if it helped

          Steph

          • 2. Re: Incremental Stacked Bar Chart
            Johan Undra

            Hi Stephane

             

            Thanks a lot for the very detailed answer. I followed your steps and it leads to a result but not exactly what I was looking for. Sorry

             

            I also did it once with a calculating field, leading to the original post picture. To give a better idea what I am trying to recreate, this is the faked target:

            tableau_stacked_bar_chart_incremental.png

            So, I have categories 12, 10, 15. I have columns A, B, C etc. Every column can have X, Y, Z categories. I would like to build up to the total incrementally. With the differences this somehow already goes in the right direction, but I need two things:

            * Somehow create an incremental chart. Maybe this could work with ABS() numbers, but how could I calculate a difference to all previous, not only the first?

            * Build the incremental chart. It doesn't necessarily be exactly as the fake but something visualizing the increase in differences

             

            I don't know if something like this is even remotely possible, hence the question ^^ But if somebody has an idea I would be more than happy.

             

             

            Thanks a lot

            • 3. Re: Incremental Stacked Bar Chart
              John Sobczak

              This is a waterfall chart.  Have you looked at the below link?

               

              https://www.tableau.com/learn/tutorials/on-demand/waterfall-charts-chart-type

              1 of 1 people found this helpful
              • 4. Re: Incremental Stacked Bar Chart
                Johan Undra

                Hey John

                 

                You are my hero of the day ^^ Darn, I am not that far down the tutorial videos. Thanks a lot.

                 

                I just have one question: I would like to have the Gantt Waterfall Stacked. From what I found this is easily possible by editing the calculation and setting all fields as addressing to sum up.

                The problem I have is that the required fields are in a secondary data source and by that not available. I tried doing it in calculated fields, but haven't found a way to set the addressing.

                 

                The problem I have is that I cannot switch the primary data source, as it is the connection between the other data sources (its 3 sources, and both connect to the central one by different fields and have no reference in-between). Is there a possible to somehow create calculated fields or something like that to address this issue?

                 

                I am trying to do it through Primary Groups as I have an A -> B -> C relation. If this works I should be good.

                 

                 

                Thanks in advance

                • 5. Re: Incremental Stacked Bar Chart
                  Johan Undra

                  Hi

                   

                  So, I created a Waterfall Gantt now and it basically works as wished for. Some minor things I might be able to handle but one bigger issue I am facing with the blended data.

                   

                  I have three sources, A, B and C. A and B are related via X. B and C are related via Y. B is primary.

                   

                  So now, the column is in A, the measure in B. I can create the Waterfall Gantt and it looks like

                  tableau_running_total_blended.png

                  Very close to what I need, but it is not stacking. As mentioned, I found the option of editing the calculation and pushing both fields, column and measure, to Addressing. Then it stacks. Unfortunately, this does not work as "Kunde" is coming from A, while the primary source is B. It just does not offer advanced and therefore I cannot change it (haven't found anything programmatically unfortunately).

                   

                  When I make A the primary everything can be changed and I get

                  tableau_running_total_primary.png

                  as wished for (besides the wrong global totals atm). The problem here is that I cannot get a relation from A <-> B <-> C, as A doesn't know about anything in C, only B. I tried via primary groups, but if I do from A to B, I only get a flat list of X, which does not match groups from C, out of B. I think this is an issue of the one-to-many relation here and makes totally sense... but was not what I hoped for ^^

                   

                  I searched a lot over the past hours and cannot find a case handling this issue. This one and I should be very good to go. Does anybody know or have an idea how this could be circumvented? I would love to have B the primary, if I could set the Addressing columns... somehow.

                   

                   

                  Thanks (and sorry for the many issues and questions ^^')