How to create an interactive Gauge Chart in Tableau

Avinash Singh
5 min readFeb 24, 2022

--

Tableau is widely used for its interactive functionality to create a dashboard, story, or other. It helps anyone to interact and understand data. There are charts or graphs available in Tableau that can be helpful. Among those, a gauge chart can provide a stunning look to the dashboard. It makes interaction with data easy and fun.

What is a Gauge chart?

A Gauge chart, known as a dial or speedometer chart, has a needle to represent information as a reading on a speedometer dial. It presents a single piece of data with a quantitative context. In Tableau, a gauge chart is a half donut chart made of two overlapping pie charts. The middle section is hidden, and a needle will indicate the data value on the chart.

Recently, I have used a similar chart to represent rating data in my dashboard. I enjoyed creating those charts, and it was fun. So, I am sharing details to create a gauge chart that will help you to mark your impression. Refer to below dashboard link -

https://public.tableau.com/app/profile/avinash.singh7257/viz/Book1_16454020488190/Dashboard1

Let us understand the chart in detail -

The chart looks basically like a donut chart. In Tableau, we can use two overlapping pie hart to create a donut chart. The second pie chart will remain hidden. Sample image —

So, how to create a gauge or speedometer chart?

Our approach is to dissect the pie chart into five parts, similar to the image below.

Part 1 — starts at 0º and ends between 0º to 90º.

Part 2 — starts and ends between 0º to 90º but, after 1.

Part 3 — starts at 90º and ends at 270º. This part will be 180º. It will remain hidden.

Part 4 — starts at 270º and ends between 270º to 360º.

Part 5 — starts and ends between 270º to 360º but, after part 4.

Calculation part (LOD) —

Part 1 — If [Value %] > 0.5 then [Value %]- 0.5 End (here, 0.5 means 50%)

Part 2 — If [Value %] > 0.5 then 1- [Value %] Else 0.5 End

Part 3 — min(1) (Hidden part)

Part 4 — If [Value %] < 0.5 then [Value %] Else 0.5 End

Part 5 — If [Value %] < 0.5 then 0.5 -[Value %] End

We will require a needle for the chart which represents data value (as reading on a dial).

Needle 1 — If [Value %] > 0.5 then 0.005 End

Needle 2 — If [Value %] < 0.5 then 0.005 End

Note — Here, Value% could be Profit%, Sales% or other as per your data set.

Let us understand all the above through an example. I have a data set that includes the audience rating for a series (source Wikipedia). I want to present my value data (Audience Score) on a gauge chart.

Let us understand all the above through an example. I have a data set that includes the audience rating for a series. I want to present my value data (Audience Score) on a gauge chart..

Example Data set -

Note — The above data set is in decimal numbers. We will convert this into a percentage.

Now, let’s create a calculation field as explained earlier.

Part 1 — If [Audience Score%] > 0.5 then [Audience Score%]- 0.5 End

Part 2 — If [Audience Score%] > 0.5 then 1- [Audience Score%] Else 0.5 End

Part 3 — min(1) (Hidden part)

Part 4 — If [Audience Score%] < 0.5 then [Audience Score%] Else 0.5 End

Part 5 — If [Audience Score%] < 0.5 then 0.5 - [Audience Score%] End

Needle 1 — If [Audience Score%] > 0.5 then 0.005 End

Needle 2 — If [Audience Score%] < 0.5 then 0.005 End

Next, drag and drop Measure Names into the Filter pane. Then, select Part 1, Part 2, Part 3, Part 4, Part 5, Needle 1, and Needle 2. See image —

Then, drag and drop Measure Names into colour and Measure Value into angle under the marks pane of the workbook. Now, your pie chart will look like below —

Then, drag and drop — “Season” into Column and “Audience Score%” into Label under the Marks pane of the workbook. Also, drag and drop “Season” into the filter. We need to assign colour code (by using colour tab under Marks pane) to the calculation field of the chart as follows -

Part 1 and Part 4 — “Green”

Part 3 — “White” (Hidden part of the pie)

Part 2 and Part 5 — “Grey”

Needle 1 and Needle 2 — “Black”

Next, we need to arrange the measure names (“Colour”) on workbook as follow -

Part 1 (“Green”)

Needle 1 (“Black”)

Part 2 (“Grey”)

Part 3 (“White”)

Part 4 (“Green”)

Needle 2 (“Black”)

Part 5 (“Grey”)

Now, the workbook will look like this (a half pie chart) —

Now, our final goal is to convert a half pie chart into a half donut/gauge chart. The last few steps are as follows —

  1. Create a dummy calculation field name — “Test” Image below -

2. Drag and drop “Test” into the colour Field of the second pie chart (dual-axis one). Your workbook will look a like Image below -

3. Now assign a colour to each Measures names of Test as follows -

Part 1, Text; Part 2, Text; Part 3, Text; Part 4, Text; and Part 5, Text — “White” (to hide the second pie chart)

Needle 1, Text and Needle 2, Text — “Black”

Now, after completing all three steps. We will get a gauge chart (half donut chart) as per our requirement. The needle represents the data value as a reading on a dial. Impressive

I hope my article will help to understand basic concepts. If you like my work, please share it with others. And, drop your comments below.

#Tableau #TableauLearning #Dashboard #Visualisation #Business Intelligence

--

--

Avinash Singh
0 Followers

Hey Folks, I like to read and write about Fintech, Stock Market, Tableau and business intelligence. Here, I am looking forward to connect with people.