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?

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

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

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?

ReplyDeleteI tried, but I've got the same error

DeleteHi Adam,

ReplyDeletecan I download this?

Yes select download on the bottom right of the chart.

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

ReplyDeleteYou can download the twbx by selecting download in the lower right of the workbook or here https://public.tableau.com/profile/adam.e.mccann#!/vizhome/SimpleGauge/SimpleGauge

DeleteThanks for sharing this tableau visualization!

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

ReplyDeleteHi. i want to ask some question, i have 2 or more parameters for this gauge.

ReplyDeletethe X is like below :

IIF ((ATTR([city])) = [city Parameter] AND

(ATTR([product])) = [product Parameter],

COS( (((1-[sales%])*240)-30) * PI()/180) , 0 )

and the Y :

IIF ((ATTR([city])) = [city Parameter] AND

(ATTR([product])) = [product Parameter],

SIN( (((1-[sales%]) * 240)-30) * PI()/180) , 0 )

the thing is, the dot was missing. is it possible for me to use calculated field with the syntax like that?

thanks before.

cheers

why Tableau doesn't create something like Power BI or Qlik for its user, for a few chart types you need to just hope someone else has made it or you wish someone will build it haha

ReplyDeletei have created calculated field using parameter. need to used that field for gauge chart. my data is in following format. five measure that present five brand. I need to present avg for that five brand measure in single chart by selecting one brand using parameter control. so please suggest how i can create gauge chart

ReplyDeletecan we show average of index multiple variables on gauge chart.using parameter we show single brand index at time on gauge please suggust

ReplyDeleteHello Sir,

ReplyDeleteThanks for this chart!

Its really helpful to me,

I have one inputs in this if we drag (-[X]) in size then size of the arrow looks very meaningful, Please try it and let me know if it works

Thanks once again

I have created the gauge dashboard and it is looking great but I would like to put a user filter on it now but because it has parameter how would I do this?

ReplyDelete