Pie Chart in Tableau is very useful to display the Sales by region, Country wide customers, Sales by Country etc. Pie Charts are also useful in the dashboard design, we can use 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 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 you 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, following screenshot will be displayed.
Now we have to change the default Bar chart to Pie Chart using the Show Me option. Please expand the Show Me window and select the Pie Chart from it as shown below
Once you select the Pie Chart from Show Me window, Pie Chart will be displayed with default colors
Please use the Size option in Marks Card to expand or Shirk the Pie chart in Tableau
If you observe the above screenshot, It is providing perfect result but 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 in Tableau
To add data labels to 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 question raised by any developer is formatting the pie Chart. This is because, the Default colors 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 straight forward. First, Please select the Pie option from the drop down list present in Marks Card
Next, Drag and Drop the Sales Amount 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, following screenshot will be displayed. Hope you understood, How easy, it is to design or create a Pie Chart
Remember, Tableau 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 Region Name on the labels Option present in Marks card
NOTE: It is always advisable to use 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 following screenshot. If you observe closely, We can’t even identify few regions.