4 Replies Latest reply on May 17, 2011 8:39 AM by guest contributor

    Stacked bar built where the bar components are from multiple fields in my source data...

    . bagofchips

      I have source data (oracle database) where each row is a type of fee.

       

      There are multiple columns, but 2 in particular are netfees and refunds.  There's also a column for gross fees, but net+refunds= gross.  What I'm trying to do is (or should be simple).  Build a series of 2-cell stacked bars- 1 bar for each fee type, and the height is gross fees while each section has height of, you guessed it, refunds & net fees.

       

      Later I'll get to whether I go 100% stacked bar or keep @ nominal #s but for now I have to get the basic thing done.

       

      This is pathetically easy in Excel and Excel doesn't care about the layout of the data, so I assume Tableau works the same -- I just need to get past all the other things exposed in the interface. :)

        • 1. Re: Stacked bar built where the bar components are from multiple fields in my source data...
          James Baker

          "Excel doesn't care about the layout of the data, so I assume Tableau works the same"

           

          This is emphatically not true.

           

          Tableau is a database-oriented program, and works with Excel by assuming an Excel table is shaped in a column->variable and row->item form.  If you instead have something more like a cross-tab, you may find it hard to do certain types of analysis.

           

          FeeType, KindOfFee, FeeValue

          feetype1, net, 10

          feetype1, refund, -3

          feetype2, net, 30

          feetype2, refund, -5

           

          In this shape, you'd chart FeeType against FeeValue and throw KindOfFee on color to break apart the FeeValue bars into colored sections.

           

          It sounds like you have

           

          FeeType, NetFees, Refunds, GrossFees

          feetype1, 10, -3, 7

          feetype2, 30, -5, 25

           

          which, when you think about "analyzing different types of fees", is already an aggregated chart: it plots the sum of each KindOfFee against each FeeType.  Now, you can certainly use this table shape in Tableau to do certain things, and you can use Measure Values and Measure Names to work with multiple columns and *almost* treat them as if they were one column.  Attached is a snapshot of my simple example.

          • 2. Re: Stacked bar built where the bar components are from multiple fields in my source data...
            . bagofchips

            Thx, and sorry took a breather on this project.

             

            Your characterization of the data as below is correct:

             

            FeeType, NetFees, Refunds, GrossFees

            feetype1, 10, -3, 7

            feetype2, 30, -5, 25

             

            (Note the gross is really net and vice versa, but no matter.)

             

            That almost works.  For some reason I can't get the bars to stack on each other - the charts themselves stack so I end up w/ 2 bar charts on top of each other rather than 1 chart w/ 2 sets of (stacked) bars.  Note that I've made the refunds *positive* (via a calculated field) to allow the refunds and net fees to truly add to what is the gross via a calculated field.)

            • 3. Re: Stacked bar built where the bar components are from multiple fields in my source data...
              James Baker

              Did you blend the two measures by dragging the 2nd on the axis of the first? Did you then drag Measure Names from the Rows/Columns to the Color shelf?  You should be able to get there by mimicking the shelf structure I posted in that picture.

              • 4. Re: Stacked bar built where the bar components are from multiple fields in my source data...
                guest contributor

                I've had problems like this with large data sets that are one row per customer, different types of costs are then columns. To get a stacked bar chart you first have to have both axes in use, you can then add as many variables as you like to the first axis and it stacks them. I often then use the second axis for a line. Not sure why this works but it does. Would be great if Tableau could deal better with cross tab style datasets.