For Corporate Training on Tableau , Power BI , QlikSense , Data Analytics , Data Science , Agile , Scrum SAFe, Pentaho contact us at info@instrovate.com ,whatsapp at – +91 74289 52788 and visit our Website – https://instrovate.com/
Subscribe to our YouTube Videos if you like Watching Videos of new Concept for free – https://www.youtube.com/c/instrovatetechnologies
If you are new To Data Analytics world and wondering why you should learn Data Visualization or Tableau visit my link that explains the importance of learning Tableau for you Data Analytics Journey – Start Your Analytics Journey – Learn Tableau
If you already Know Tableau lets get started . I had been getting this frequent requirement of creating a Gauge Chart during my several Tableau Training in Gurgaon ; and I like always thought that it is not possible to create one in Tableau, until I came across Adam McCann’s post where he actually explained how to create a Gauge chart in Tableau. He presented with Chris DeMartini at the Tableau Conference in Austin on how to create custom chart types in Tableau and this was one of them. Ever since this has been one visualization which I am fond of .
Let us execute these steps to create a Gauge Chart in Tableau by using Sample Superstore dataset. We will be showing the Sales of various Sub Categories through Gauge Chart.
Step-1:
Show the Sub Category Sales.
Step-2:
We will create a Calculated Field that will normalize the Sales and change the Sales to percentage. The formula will be:
Sales% = SUM([Sales]) / WINDOW_MAX(SUM([Sales]))
Go to the Data pane and right click the field Sales%. Go to Default Properties → Number Format → Percentage. Now this will show the Sales % value in % like below image:
Step-3:
Now, we have to create the Gauge Arch. Since we will create a semi-circle Gauge we will create an Angle field as semi- circle and plot X and Y points.
Create a Calculated field Angle with the following formula:
Angle = Sales% * 180
This will give us the plotting in semi- circle manner and we will use this field for some more calculations. Also, make this as Number Whole from the data pane→ Change Data Type option. When we bring this field to the viz, because it’s a table calculation Compute Using Sub Category.
Create a Calculated field X with the following formula:
X = 1 + SQRT(2) * COS((1-[Sales%])*180 * PI() / 180)
Create another Calculated field Y with the following formula:
Y = 1 + SQRT(2) * SIN([Angle] * PI() / 180)
The X and Y calculated field created here will be a table calculation; so when we bring it to the sheet we will check Compute Using- Sub Category.
Now, let’s plot X & Y on the sheet with Sub Categories in Detail shelf. Check X & Y field to make it Compute Using→ Sub Category. The viz will look like below:
Step-4:
Create a parameter that will help you choose a Sub Category and plot another Sub Category as origin.
Now add this parameter in previously created X and Y field. For better understanding I have created altogether a new X with parameter and Y with parameter calculated field again.
X with parameter = IIF(ATTR([Sub-Category])=[Parameters].[Sub-Category],
1 + SQRT(2) * COS((1-[Sales%])*180 * PI() / 180),1)
Y with parameter = IIF(ATTR([Sub-Category])=[Parameters].[Sub-Category],
1 + SQRT(2) * SIN([Angle] * PI() / 180),1)
Step-5:
Add X with parameter & Y with parameter in the viz and choose Compute Using — Sub Category for both the fields.
Drop Sub Category in Detail shelf. The viz will look like below after editing the X axis:
Because we want to show the Sub Categories as a pointer in the gauge; we will change the circles to a line for better formatting, like below:
Step-6:
Add a Background Image in the workbook:
When you click on the data set Name- Orders(Sample- Superstore) in this case, you will get the below dialogue box:
Click on Add Image and then browse for the gauge image.
So, after adding the Background Image the dialogue box looked like below:
Pay extra attention to the highlighted area as those are the changes that you have to make after browsing for the Image in Tableau.
Once done, you will have to Edit X Aix by fixing the Range from -0.5 to 2.5 like below:
Now, the vix looked like below:
Step-7:
Finally, we will do some beutification to finish up the viz. Duplicate thr field Y with parameter that is in Row shelf by dragging another one from the data pane to the row shelf.Once done, you will notice that you have 3 Marks card now. Go to one of the Marks Card for Y with parameter and bring out the Shapes. Choose the shape you want- I choose a Diamond. Then Synchronize your dual axis and hide the Axis that appears on the right side. Put the Parameter, Sales and Sales% field in the Marks Card that shows Shapes.Bring the parameter to sheet by selecting Show Parameter Control. Your Gauge Chart is ready and looks like below:
Thank you Adam McCann for making it so easy. You can download Tableau Workbook of the Gauge chart from Adam’s Tableau Public profile from below link:
For Corporate Training on Tableau , Power BI , QlikSense , Data Analytics , Data Science , Agile , Scrum SAFe, Pentaho contact us at info@instrovate.com and visit our Website – https://instrovate.com/
Click on the Instrovate Icon to Visit Our Website to see the Comprehensive list of Courses and Consulting that we offer as Corporate , Online & Academic Training and During our Consulting Project works .
Subscribe to our YouTube Videos if you like Watching Videos of new Concept for free – https://www.youtube.com/c/instrovatetechnologies