Deficit Analysis Chart in Tableau (Pie Chart)

Blog | August 25, 2018 | By Vijai Narasimha

Visualizing Deficits: Pie Chart Method in Tableau

Analyzing Deficit Data: Tableau Pie Chart Visualization

Understanding Deficit Analysis: Pie Chart Method in Tableau

Effective Visualization Techniques: Deficit Analysis with Tableau Pie Charts

Exploring Data Insights: Tableau’s Pie Chart Visualization

Making Informed Decisions: Deficit Analysis with Tableau Pie Charts

As discussed in one of the previous blogs, Deficit/Surplus Analysis is a very interesting concept in data analytics. It has deep impact on a company’s growth and progress. The word Deficit can be used as the noun form of Deficient (Deficiency) meaning less nourishment which is not restricted to food.

The common way of representing Deficit or Surplus would be a simple Percent Change calculation. In the previous blog, we used a modified waterfall chart. In this blog, we will build a special Deficit Donut chart (a slightly modified Pie Chart).

Though Deficit and Surplus go hand in hand, analysts in general refer to it as Deficit Analysis. The concept is very simple and straight forward. We usually have a Start Value or the Threshold and an End Value or the Actual. What is the change between the Start and End values? Did it Increase or Decrease? How can we represent with a simple intuitive chart? If the Values Decrease from the original, it will be termed as a Deficit (Under-performance). If it is more, it will be termed Surplus (Over-performance).

Deficit Analysis can be used for a lot of situations like Process completion to 100%, Calorie Intake & Nutrition Deficit, Revenue & Expenditure, Imports & Exports – Trade Deficit, Budget Deficit, Stock Volume – Break Value, Profit & Loss, Income & Expenses, Equity – Assets – Liabilities, Actuals & Forecast, Inventory – Demand & Supply, Consulting – Project availability & Resource allocation and list goes on.

For this example, we are focusing on Import/Export Analysis. The idea is, if the Import is higher than the Export then it is a Deficit value. If it is the other way around, then it is a Surplus value.

We are using a very simple file with 5 years of data with some random values. We have the Year dimension, Import measure and Export measure. For every year, we need to show if there is Deficit or Surplus. If needed, we can also add some percentages.

There are a couple of tricks and hacks required for this chart. Let us go step by step. This chart looks great with a Donut chart, eventually we will do it. But to start, we will go with a simple Pie Chart.

Since we are building a Multi-measure Pie chart, we need to prepare/create the appropriate measures. Like in the water fall chart, the Deficit or Surplus is calculated for the higher value, here too we need to focus on the bigger value.

Since the Pie chart is constructed for 100% (360 degrees), we need to evaluate our options that can fill the 100% along with lower value to make up the higher value i.e. If Export is higher than the Import value, then it is a Surplus, so Surplus and Imports together make 100% of the Pie. If Import is higher than Export, then it is a Deficit, so Deficit and Exports together make 100% of the Pie.

Though our visualization won’t be exactly like this, this gives the overall idea.

1) Convert the Year field on Dimension into a Discrete field. This can be done on the view as well. Use the Year field on Columns or Rows. In this case, Columns.

2) Next, we need to prepare the required measures. In this case we will be building a multi-measure Pie (Donut) Chart. We can build a basic 3-measure pie chart or an advanced 5-measure pie chart. For this example, we shall go with the easier 3-measure approach.

Measure 1: Surplus. If the Exports are higher than Imports then difference between Exports and Imports

Measure 2: Deficit. If the Imports are higher than Exports, then difference between Imports and Exports

Measure 3: Filling field (or placeholder). This is a field that when used along with Surplus or Deficit will make up 100% (360 degrees). So, if Surplus needs to be shown then we need Imports. If Deficit needs to be shown then we need Exports.

3) Next step would be to build the Pie chart with all 3 measures

a) Convert Marks to Pie

b) Use Measure Names on filter. Select only Deficit, Placeholder and Surplus measures

c) Use Measure Values on Angle card

d) Use a copy of Measure Names on Color card

That is all that we needed. Here we should note that the sort order has to be Descending. As demonstrated in the image before, the Surplus has to be on the right, crossing the 100% mark and Deficit has to be on the left trailing the 100% mark. The sort order for a Pie is in clock-wise direction.

4)      There are a couple of cosmetic steps if needed.

a) Change in color for the Deficit (Red), Surplus (Green) and remaining value (any other neutral color). If focusing on Best practices, need to pick the right color.

b) Adding some borders for the Pie chart to stand out.

c) Adding labels for the appropriate measures.

d) Convert into a Donut chart. There are a lot of posts using Number of Records or a placeholder calculation with a value of 1.

An advanced or improved version with more measures can also be created:

We can stop at this stage. But as mentioned before, we will be adding the % Deficit or % Surplus values inside the Donut to make it more intuitive for End Users.

Creating Deficit Analysis Charts: A Tableau Tutorial

Leveraging Pie Charts for Deficit Visualization in Tableau

Pie Chart Visualization: Analyzing Deficits in Tableau

Enhancing Data Interpretation: Deficit Analysis with Tableau Pie Charts

**Optional**

5) The Deficit Percentage is calculated for the whole of Imports. The Surplus percentage is calculated for the whole Exports. Or, another way to approach would be to show only the Extra value achieved for the Surplus.

Also adding some simple shapes. We can customize it in numerous ways. But keeping it simple using the Character Map (Character Palette/Viewer in Mac)

Finally arriving at this visualization:

About the Author
A BI Analyst and Tableau trainer working for USEReady since 2015. Well versed in Data Analysis, ETL and Dashboard building across different business domains.
Vijai NarasimhaSenior Business Intelligence Analyst | USEReady