8 Replies Latest reply on Jun 21, 2018 12:46 PM by waqar.ahmad.0

    How to show % labels on pie charts using the sum of the measure values?

    Boone McAfee

      Hi,

       

      I'm new to Tableau Public.  I created a pie chart which shows the measure values, but I also would like to display the percentage of the sum of the measure values.  Can someone explain how I might go about doing that?  I've attached a screenshot of what I have so far.

       

      Appreciate any help!

      Boone

        • 1. Re: How to show % labels on pie charts using the sum of the measure values?
          Jim Dehner

          see below

           

          you can adapt sales to your measure

           

          Jim

          If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

          1 of 1 people found this helpful
          • 2. Re: How to show % labels on pie charts using the sum of the measure values?
            Boone McAfee

            Jim,

            Thanks for responding.  I'm brand new to Tableau so at this point I don't even know all the functions of the program.  Just looking at your screenshot I don't fully understand what is being done.  I'm really looking for some step by step instruction...

            Thanks

            • 3. Re: How to show % labels on pie charts using the sum of the measure values?
              Venkat Thota

              Go to Measure Values section, right click on SUM(Net Ethonol (mil bu)) -> Quick Table calculation -> Percent of Totals. You need to do for all other measures values.

              Hope this helps.

              • 4. Re: How to show % labels on pie charts using the sum of the measure values?
                Jim Dehner

                first welcome to tableau

                 

                you have a pie chart that is based on sa measure and when you plotted the measure as a pie the absolute value appeared on the chart as text

                 

                what I did was add a secondary calculation that I did not plot only put on Label in the marks card

                 

                any thing placed on text will show up but can change that also

                 

                 

                Now the % will show up on the chart

                 

                Tableau has a very good free video course that will take you from "Getting Started" to Advanced Calculation

                Tableau Training: View Training Courses

                 

                Jim

                If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

                1 of 1 people found this helpful
                • 5. Re: How to show % labels on pie charts using the sum of the measure values?
                  waqar.ahmad.0

                  Hey Boone McAfee,

                  What you're looking to do is to create something in Tableau called a "Calculated Field". This field will allow you to create the Percentage that you want. In Jim's example above, He's creating a calculated field called "Percent of Total" which is made up of some simple math. This math is The text within the Calculated field we just created and is the solution for how you will get percentages.

                   

                  to create a calculated field, simply click the Drop down at the Top of the Dimensions pane which is next to the magnifying glass , and click "Create Calculated Field" first option. Then you can call it whatever you'd like "Percent of Total" is a great name in your case, and copy the text that he's using into this field. Then click okay and you now have a Calculated field that you can drag into your viz just as you would any other field.

                   

                  The last step is to drag it into the Viz but Where you drag it is the important part. The "Marks" area of the Tableau pane is where you can specify what the data will LOOK like in your visual. If you drag it onto Label you will see the T next to it specifying it as a label. Labels in Tableau will take the form of text and will show up accordingly in your sheet.

                   

                  The last step is to convert this calculation into a Percentage. The way this is done is to take the field we just dragged onto label in the marks card, Click the drop down in the field and click "Quick Table Calculation" > "Percentile".

                   

                  This should give you your answer.

                   

                  Thanks,

                  W

                  1 of 1 people found this helpful
                  • 6. Re: How to show % labels on pie charts using the sum of the measure values?
                    Boone McAfee

                    Appreciate all the assistance, this has been very helpful just to learn where everything is at .  I'm still running into a problem though.  In Jim's example he is working with one measure (sales).  In mine (see screenshot) I am working with 7 measures that make up the pie.  So just to try it, I created a calculated field for my first measure (net ethanol), using the formula: SUM (Net Ethanol) / (SUM(Net Ethanol)+SUM(Feed)+Sum(Net Exports)+etc...  in other words, my first measure divided by the sum of all measures.  I dragged that calculation onto Labels in Marks and the correct calculation shows up, but it's on all sections of the pie graph even though it only applies to one measure (Net Ethanol).  Is there a way I can only apply the label only to the correct measure represented in the pic graph, and then create the calculation for all other measures?  Or is what

                    I'm trying to do not possible with the way I have my data currently formatted?

                    Capture.PNG

                    • 7. Re: How to show % labels on pie charts using the sum of the measure values?
                      Boone McAfee

                      Reformatted my data and tried again - got it!  Thanks for all the help!

                      Capture.PNG

                      • 8. Re: How to show % labels on pie charts using the sum of the measure values?
                        waqar.ahmad.0

                        Fantastic Boone,

                         

                        Glad it worked out for you.