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:

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.

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).

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.

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?

ReplyDeleteThis 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

ReplyDeleteThank for the good topic,Thanks for your sharing.

ReplyDeleteหนังตลก

This comment has been removed by a blog administrator.

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

DeleteSee below

DeleteCan 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.

ReplyDeleteThis 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.

DeleteCan u tel me how u came up with the angle calculation ?

ReplyDeleteSee below.

DeleteThis is really helpful but can someone tell me how the Angle is calculated?

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

DeleteHi 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.

DeleteHi Adam,

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

Thanks

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

ReplyDeleteHi Ravi - What kind of filter? Like region from the super store set?

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

ReplyDeleteThis comment has been removed by the author.

ReplyDeleteThanks for your informative article.Its Really very useful for my visualization project.Thank you So much dude.Tableau Training in chennai

ReplyDeleteHi 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?

ReplyDeleteHey Adam or anyone else who may be able to answer this,

ReplyDeleteI 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!

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

ReplyDeleteI 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?

ReplyDeleteHi Adam,

ReplyDeletecan I download this?

Terrific post however , I was wondering if you could write a litte more on this subject? I'd be very grateful if you could elaborate a little bit more. Thank you!

ReplyDeleteTableau Online Training

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?

ReplyDeleteI 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.

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

ReplyDeleteIt's Very Nice and Such an ideal piece of blog

ReplyDeleteTableau Online Course

Thanks for sharing this tableau visualization!

ReplyDelete