5 Replies Latest reply on Jun 25, 2013 7:41 AM by Matt Lutton

    Help Me Create a Pie Chart (even if you don't like pie)

    Matt Lutton

      So, just for fun and because I want to, I'm trying to express the following bar chart as a pie.  I tell you my reasoning so I don't get the "don't use pie charts" lecture--I know, I know.  I just can't figure this out and its bothering me.

       

      The pie "slices" would represent each of the letter grades and the percent of total grades they make up.  I am certain I am making it more difficult than it really should be. 

      LetterGrade_PieChartHelp.png

       

      [Letter Grades] is a calculated field, like:

      IF ISNULL([Total Score]) OR [Total Score]=0 THEN "Incomplete"

      ELSEIF [Total Score]>0.89 THEN "A"

      ELSEIF [Total Score]>0.79 THEN "B"

      ELSEIF [Total Score]>0.69 THEN "C"

      ELSEIF [Total Score]>0.59 THEN "D"

      ELSE "F" END

       

      The bars shown in the graph above are created by counting the number of students (not distinct) who have each grade.  I've tried creating a calculation for each Letter Grade, but that didn't work and I am thinking it has to be much simpler than I am making it. I have created pie charts in Tableau many times, so I'm familiar with how it normally works.

       

      Thanks and sorry I don't have a more complex problem for you all to solve!

        • 1. Re: Help Me Create a Pie Chart (even if you don't like pie)
          Mark Holtz

          Hi Matthew,

           

          Honestly, the easiest solution I've found to create a pie is to ctrl+click the dimensions you want, the measure, and then use the "Show Me" tab to render the pie chart. If you have more dimensions than are recommended, it might complain and not let you do it, so start with 1. You can always then add to the Detail or Label shelf to bring in more information.

           

          In your specific case, I believe you need to make the categorical [Letter Grade] field a dimension first. Create the calculated field and then drag it to the Dimensions section.  (Assuming Total Score is a field in your data and not something funky like a table calculation.)

           

          If each record is a student, you can use that [Letter Grade] dimension and the [Number of Records] (summed) measure.

           

          If your data is something more complicated, I'd recommend you post a packaged workbook for further assistance.

           

          Cheers

          1 of 1 people found this helpful
          • 2. Re: Help Me Create a Pie Chart (even if you don't like pie)
            Justin Emerick

            Matthew,

             

            I've had issues in the best with Tableau's "show me" buttons so I know just creating Pie Charts in a more manual process. Basically there are only 2 main components of the Tableau UI that you need to focus on: ANGLE and COLOR. The rest, like Mark said, is just for creating better labeling and detail.


            With that, create a new worksheet with a blank canvas. In the "Marks" drop down, select "Pie."


            Drag CNT(Students) in the ANGLE and drag LETTER GRADE into the color. If that doesn't work it's likely due to the way the calc fields are generated (possibly the letter grade is in your Measure shelf and needs to be moved to the Dimension shelf), If you run into trouble, upload your workbook to the thread.


            Justin

            • 3. Re: Help Me Create a Pie Chart (even if you don't like pie)
              Matt Lutton

              Thanks for taking a look, Mark.  No "Show me" combination will work here.  Each record represents a grade that a student received (or is receiving) in a course.  As I mentioned, the bar chart was created by using a Letter Grade calculation, sliced by the count of students who received each grade.  I'm assuming there's gotta be a way for me to use the same data to represent this in a pie, visually.

               

              No packaged workbook on this one, I'm afraid--just looking for insight into how to re-evaluate the scenario from another angle.  Appreciate the help!

              • 4. Re: Help Me Create a Pie Chart (even if you don't like pie)
                Matt Lutton

                Thanks, Justin.  This is what I have done several times, based on my own experience with manually creating pie charts, but it hasn't worked thus far.  Perhaps its as simple as moving the calculated field into the dimensions area, but I don't think it was allowing me to do that.  Will give it a go as soon as possible, but appreciate you confirming what I suspected.

                1 of 1 people found this helpful
                • 5. Re: Help Me Create a Pie Chart (even if you don't like pie)
                  Matt Lutton

                  Figured it out, [Total Score] was another calculation, and I was able to create a dimension called "Letter Grades" and use the same steps laid out by Justin to create the chart.  Thanks all.

                  1 of 1 people found this helpful