Pie Chart in Tableau is very useful to display the Sales by region, Countrywide customers, Sales by Country etc. Pie Charts are also useful in the dashboard design, we can use the Tableau pie chart to display Country wise sales and then use the Action filters to further drill down.
In this article, we will show you, How to Create Pie Chart in Tableau with an example. For this we are going to use the Data Source we created in our previous article. So, Please visit Data Labels in Tableau Reports article to understand the Data Source.
If you want the Custom SQL Query Only for this report then use the following query as your SQL Server Data Source
SELECT Geo.[EnglishCountryRegionName] AS [Country] ,Geo.[StateProvinceName] AS [State] ,SUM(Cust.YearlyIncome) AS YearlyIncome ,SUM(Fact.SalesAmount)AS SalesAmount FROM DimCustomer AS Cust INNER JOIN FactInternetSales AS Fact ON Cust.CustomerKey = Fact.CustomerKey INNER JOIN [DimGeography] AS Geo ON Cust.GeographyKey = Geo.GeographyKey GROUP BY Geo.[EnglishCountryRegionName],Geo.[StateProvinceName]
Create a Pie Chart in Tableau Approach 1
First, Drag and Drop the Sales Amount from Measures Region to Columns Card. Since it is a Measure value, Sales Amount will be aggregated to default Sum.
Next, Drag and Drop the English Country Region Name from Dimension Region to Rows Card. Once you drag them, the following screenshot will be displayed.
Once you select the Pie Chart from Show Me window, Pie Chart will be displayed with default colours
Please use the Size option in Marks Card to expand or Shirk the Pie chart in Tableau
If you observe the above screenshot, Tableau Pie chart is providing perfect result. However, we are unable to identify the difference between Sales in France and Sales in Germany. To resolve these situations, We have to display the Data Labels.
Add Data labels to Pie Chart
To add data labels to Tableau Pie chart, Please drag and Drop the data Label values from Dimension or Measures Pane to Label option in Marks Card.
In this example, We want to display the Sales Amount as Data labels so, Drag and Drop the Sales Amount from Measures region to Labels option
Tableau allows us to add Multiple Measure values as Data Labels. This can be very useful when want to compare the Total Sales against the Profits by Region. To do this, Use the above technique to place the Yearly Income
Format Pie Chart in Tableau
One of the most common questions raised by any developer is formatting Tableau Pie Chart. This is because the Default colours or Default Pie Chart pallet may or may not be attractive to end-user.
To do this, Please select the Edit Colors.. option from the context menu as shown below
Once you select the Edit Colors.. option, a new window called Edit Colors will be opened to select the Color Palette for English Country region name. For demonstration purpose, we are selecting the Color Blind 10 as shown below
Click Apply button and then Click OK to finish it
Create a Pie Chart in Tableau Approach 2
This method is very easy and straightforward. First, Please select the Pie option from the drop-down list present in Marks Card
Next, Drag and Drop the Sales from Measures Region to Filed region as shown below. Since it is a Measure value, Sales Amount will be aggregated to default Sum.
Next, Drag and Drop the English Country Region Name from Dimension Region to Color option in Marks Card as shown below.
Once you drag them, the following screenshot will be displayed. Hope you understood, How easy, it is to design or create a Pie Chart in Tableau
Remember, Tableau Pie chart allows us to add both Dimensions and Measures as the Data Labels. To demonstrate this, We just placed the Sales Amount Measure and English Country Name on the labels Option present in Marks card
NOTE: It is always advisable to use Tableau Pie charts on High-level Data. For instance, If you use the same Pie Chart for State-wise sales rather than Country wise, you will end up with the following screenshot. If you observe closely, We can’t even identify a few regions.