How to Create Pie Chart in Tableau?

In our Salesforce organization, we were working on lead management and needed to visualize data statistics, such as lead status and lead source. The built-in charting features of Salesforce were helpful, but we wanted a more dynamic chart that allowed us to apply multiple filters and visualize data.

For this, we used Tableau to create a pie chart displaying lead source statistics. This pie chart displays the lead source statistics, including Website, Phone Enquiry, Referrals, and Events. By visualizing this data, we were able to identify which sources were generating the most leads.

In this blog, you will learn how to create a pie chart in Tableau. Additionally, I will explain how to adjust the pie chart size and change its colors.

Create a Pie Chart in Tableau

In Tableau or other data visualization tools, a pie chart is a circular chart divided into slices, where each slice represents a proportion of the whole dataset. It’s helpful in displaying the breakdown of data and helps to show data as a percentage of a whole in each slice.

In the examples below, we will cover the following two methods to create a pie chart in Tableau.

  • Create a Pie Chart with Data Connection in Tableau
  • Create a Pie Chart using an External Excel file

Create a Pie Chart with Data Connection in Tableau

To create a pie chart, first, we need to connect Tableau with a data source. In this example, I have connected Tableau with the Salesforce data. Here, I will use the lead data to create the pie chart.

After connecting Tableau with the data source, follow the steps below to create a pie chart.

  1. In the Tableau, click on the Sheet. I have selected the data source as Salesforce leads, so it will display the lead fields in the Tables section.

In the Marks section on the sheet, select the option Pie.

Create a pie chart in tableau
  1. Here, I need to visualize the Lead source; for that, I’ll drag and drop the Lead Source field onto the Color card in Marks.
Tableau Custom pie chart
  1. To add the label of the lead sources and display lead count for each source, add the fields Lead Source and Lead Count to the Label card.
Add values to pie chart in Tableau
  1. At this point, the pie chart will show the lead source and count for each angle, but it will overlap the label. Here, we need to increase the chart size.

To increase the chart size, click on the Standard dropdown in the toolbar and select Entire view.

Resize pie chart in Tableau

Now, the pie chart will be in the appropriate proportion.

Tableau desktop pie chart

Check out: Tableau Funnel Chart

  1. To increase or decrease the size of the pie chart, click on the Size card in the Marks. To adjust the size of the pie chart, move the slider left or right.
Custom Pie Chart in Tableau

This way, we can create a pie chart to analyze the data in the table using Tableau.

Check out: Add Charts to Reports in Salesforce

Create a Pie Chart using an External File in Tableau

In some cases, it is not possible to set up a connection with the data source using the server. In my case, I had to create a pie chart using the data from the Salesforce report table.

The Report object in Salesforce does not store actual record data like Leads, Opportunities, etc. As a solution, I exported the Salesforce report and used it in Tableau.

Check out: Stacked Bar Chart in Tableau

Follow the steps below to create a pie chart using an external file in Tableau.

  1. Open the Tableau app, and navigate to the Connect section. Select the data format of the source file. In this example, I will use an Excel file.
Create a pie chart in tableau with external file
  1. Upload the file from your system. In this connection, the uploaded file will be there as a Data Source.
  2. To create a pie chart, click on the Sheet at the bottom of the window.
  3. To create a pie chart, we need two Measure fields (#) and one Dimension field (abc). Under the Tables section, select the fields with Ctrl+right click.
Visualize data using pie chart in Tableau

Check out: Embed Report Chart to Salesforce 

  1. After selecting the fields, go to the Show Me tab and select the pie chart.
How to create a Pie Chart in Tableau

Now, the pie chart will display the ratio of field data for the selected fields.

  1. To add the label, drag the field names to the Label card in the Marks section.
Add Lables to Pie Chart in Tableau

Now, to set the chart in proportion to the labels and make it a bit bigger, click on the Standard dropdown in the toolbar and select Entire View.

Increase Pie Chart Size in Tableau

In the Entire view, the label and the count will not overlap, and the pie chart will be bigger in size.

Create a dynamic Pie chart in Tableau

This way, we can create a pie chart using an external file in Tableau.

Check out: Create Stacked Bar Charts Dashboard in Salesforce

Adjust Colors in Tableau Pie Chart

The pie chart will display each slice with a unique color. We can also change the slice color in the pie chart.

To change the slice color, click on the Color card and then click on Edit Colors.

Change the Pie Chart Color in Tableau

Now, select the data item for which you have to change the color. Then, from the available color pallets, select the color and click Apply.

Modify Colors in Tableau pie chart

This way, we can modify the colors in the Tableau pie chart.

I hope that by following the above steps, you were able to create a pie chart in Tableau using both live Salesforce data and external Excel files, setting the connection accordingly.

With the additional customization options, such as resizing and color adjustments, you can modify the pie chart UI according to your requirements.

You may also like to read:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.