### How To Create a Gauge Chart in Tableau (UPDATED)

A while back I wrote a post on how to create a gauge chart in Tableau. At the time I felt bad about writing it because I thought it was a bad chart. I have since come around on the gauge. See my previous post on bullets vs gauges for mobile dashboards. And this created some convo on the Twitters about the merits of the gauge. But I think it's an unfairly maligned chart type.
So I think this should be an available chart type to create simply in Tableau. But the old approach I outlined required too much data re-shaping. So at last year's Tableau Conference I presented a new way of creating a gauge that required no data re-shaping. Just a bit of math. Outlined below are updated steps for creating a gauge in Tableau.

For this example I used Superstore Sales; The best damn dummy data set in town. This gauge will show sales by Product Sub-Category relative to one another. So we start with Sub-Category [Sales].

Then we have to normalize sales to put it on a 0 to 1 scale. So I create a new calculated field called [Sales%] using the following formula:

Which converts the scales from dollars to percentages normalized from 0 to 1.

We will use this new field [Sales%] to create the X and Y coordinates which points the gauge needle to a point on the circumference of the gauge. For this gauge I am only using 180 degrees or a semi-circle from 9 o'clock to 3 o'clock on a watch face. Gauge ranges vary. To adjust the angle you simply need to adjust the number 180 in the below calculated field. To create the X and Y calculated fields I use a parametric equation with the [Sales%] field above. For now I am calling these fields [X All] and [Y All]

Sales x 180 essentially creates an angle such that the highest point is at 180 degrees and the lowest at 0 degrees. Now we have the following fields.

When you place [X All] in the columns shelf and [Y All] in the rows shelf then set the calculated field to compute using Sub-Category we get something that looks like this. Beautiful I know. All Sub-Categories are positioned from left to right, lowest to highest sales along the circumference.

But we want a single point for each Product Sub-Category. To do this we will need a parameter to identify the specific point we want to show. So we create a parameter called Sub-Category with the same fields as Product Sub-Category. The fastest way to do this is to right-click on the dimension Sub-Category and select Create > Parameter.

Then we need to tie our X and Y coordinates to this parameter to only show a single point. So we modify the [X] and [Y] measures slightly. In addition to only showing the coordinates of the selected Sub-Category we also need a fixed origin point; in this case 1,1. This places all points not tied to the parameter at the origin point. Which we will use to create the line of the gauge.

Now we have the measures we need. We place the new [X] and [Y] measures into the columns and rows shelves respectively. Then set the calculated field to compute using Sub-Category and set the mark types to line. The new point on the circumference is tied to the parameter and the rest of the points are placed at the origin point (1,1).

We are almost there. Add a background image with shaded reference points setting the X field to X and the Y field to Y. The left is set at 0.5 and right at 2.5. The bottom at 1 and top 2.5  I created this one in PowerPoint using pie charts. This unfortunately makes the context points for the chart stagnant.

Finally, format the Tableau elements as you set fit. I thickened the bar, changed the color, and added a white border. I then added some labels and legends.

I hope this is helpful. Please let me know if you have any questions in the comments below.

1. Thanks a lot for the detailed explanation.. Really Useful. Just a quick question, In my graph i have a used%. Is it possible to show the Used% on a Gauge chart? I mean if i have just 27%, how to show it on the gauge scale without using the parameter?

1. Hello Nani, Were you able to convert this chart to percentage gauge chart without using parameters? I'm trying to achieve percentage gauge chart but not able to figure out X and Y axis calculations.

2. This is amazing. Thank you for a detailed explanation. Just a thought on the calculation of "X All" and "Y All", I think we can remove "* 180" and "/ 180" as they both get terminated. This would reduce the calculation. Please correct me if I am wrong. Cheers

3. Thank for the good topic,Thanks for your sharing.

หนังตลก

4. This comment has been removed by a blog administrator.

1. I am slightly confused about the Angle Field calculation. Can someone please provide the same ?

5. Can anyone tell me how to do a similar gauge chart with multiple needles/pointers in Tableau? I mean in the above gauge chart, I want to show all pointers/needles for all sub-categories without selecting any value in the parameter.

1. This is not possible in this version. Because you need an origin point. The other non-selected points is that origin point. You could modify your data to have a fixed anchor/origin point in your data through a simple union join. Then don't apply any IF THEN filter in the calculation. Hope this helps.

6. Can u tel me how u came up with the angle calculation ?

7. This is really helpful but can someone tell me how the Angle is calculated?

1. The angle is just normalized sales (%) multiplied by total degrees of the gauge or 180. It ultimately is not used in the calc.

2. Hi Adam, we don't understand it clearly. Could you please write bellow the exactly details that we should write to creat the parameter angle? Thanks in advance! Good job by the way! Very helpful.

can you explain give an example of normalized sales (%) multiplied by total degrees of the gauge or 180?
Thanks

8. Hi can u tell me how to configure this chart for a filter.

1. Hi Ravi - What kind of filter? Like region from the super store set?

9. I also need same gauge but with multiple selections e.g in filters

10. This comment has been removed by the author.

11. Hi Adam, really nice work here, thank you! I do however have a question: in my set of data when choosing some parameters, the gauge line disapears and it shows "1 NULL". Is there a problem with my set of data?

12. Hey Adam or anyone else who may be able to answer this,

I have looked at both this blog and http://duelingdata.blogspot.com/2013/05/gauge-hate.html?showComment=1486722314166. I have made my own chart, but it has a problem. Whenever I hover over the starting point, it displays all of the data point's names instead of a nice X:1, Y:1. How can I either get the names to disappear or set 1,1 as the starting point for the x,y coordinate? Any help s greatly appreciated!

13. I cannot get it to work. can you upload the demo file for me, please? thank you so much.

14. I initially tried this without a table calculation and could not use attr(). Error non-aggregate and aggregate don't mix. After creating table calc. When creating x,y coordinates only value in the viz is 2.4 and 1, what am I doing wrong?

16. Hi, I'm stuck with this example. My X and Y values don't seem to be correct. I downloaded the public document and it appears I have everything right. Did anyone else run into this?

17. I tried it . It is working for me.In Y instead of using Angle, I used same formula as X and replacing Sin with Cos. Please let me know how to change the needle size.

18. Could you share your book? I'm trying to replicate the "\$73K" but I can't.

19. Thanks for sharing this tableau visualization!

20. This comment has been removed by the author.

21. I like your blog, I read this blog please update more content on hacking, further check it once at Tableau Online Course

22. Hi there, I'm trying to create a Gauge but to show 12 months within the Gauge. So the Gauge will show 12 slices basically and therfore I could have the Total Sales for the current month that way. Please help if you can...

div#ContactForm1 { display: none !important; }