Showing KPI percent change in Tableau with Gauge Charts
I’m back — with another chart the working of which I could not find on the net. As before, I will detail the steps to make the chart.
But first let’s understand the context.
There are a plethora of Gauge charts available on the net. But the requirement was to reflect the KPI percentage change in a particular manner. If the change is positive the right side should reflect the percentage and vice-versa. You can refer to the main pic above the title for the same. So, let’s begin how I went around achieving the same.
Step 1: Prepare a dummy dataset. We will use this data to prepare our gauge chart. <Refer Fig 1>.
Step 2: Now let’s list our calculations in order. First, we will deduct the field of percentage change by half. <Refer Fig 2>.
Step 3: Create a calculated field ‘1. A’. This field will reflect the negative percentage change and will appear on the left side. <Refer Fig 3>.
Step 4: Create calculated field ‘1. B’. This field will reflect the remaining part of the left side. <Refer Fig 4>.
Step 5: Create calculated field ‘1. C’. This field will reflect the positive percentage change and will appear on the right side. <Refer Fig 5>.
Step 6: Create calculated field ‘1. D’. This field will reflect the remaining part of the right side. <refer Fig 6>.
Step 7: Create a calculated field ‘1. E’. The reason for this field is to specify the width between the two ends of the three-fourth circle that we’ll create. You can change this value and view the difference yourself later. <Refer Fig 7>.
Step 8: Create a calculated field ‘1. Needle1’. This will indicate the end of the negative percent area. <Refer Fig 8>.
Step 9: Create a calculated field ‘1. Needle2’. This will indicate the end of the positive percent change area. <Refer Fig 9>.
Step 10: Create a calculated field ‘Dummy’. The reason for this field is to carry the percentage change as a label. <Refer Fig 10>.
Step 11: Now let’s begin placing these fields and others in the sheet area.
a. In the columns bar above, type MIN(0) twice and in the Marks card of ‘ALL’ select pie in the drop down.
b. Place the Metrics field in the filter pane and select ‘A’.
c. Drag ‘Measure Names’ in the filter pane and select as shown below. <Refer Fig 11 a>.
d. Move ‘Measure Values’ in the details card and ‘Measure Names’ in the color card of top — MIN(0) . And in the same card, increase the size of the pie chart. Then in the color card on the right side of the screen, ensure the order of the calculated field as shown in the figure. Also ensure at this stage the colors of the fields are as shown. You can make the color changes as per your requirement later on. <Refer Fig 11 b>.
e. Now change the ‘Measure Values’ as shown in the above image from details card to Angle. The pie chart will change as shown below. <Refer Fig 11 c>.
f. Click on the dual axis on one of the MIN(0) in the Columns bar above. And change the color of the second pie as white. <Refer Fig 11 d>.
g. Now place ‘Dummy’ field in the color tab and ‘Percentage Change’ field in the label card of the second pie. Increase the size of the label as per your choice. And increase the size of the second pie marginally. <Refer Fig 11 e>.
h. Clear the sheet by removing the grid line, zero lines, row divider and column divider as none, uncheck the ‘show header’ and ‘include in tooltip’ option of MIN(0) in the column bar above.
i. Remove all unwanted tooltips and labels as well.
j. You can now right-click on the Metric field in the Filter pane and select Show filter. With this select different Metrics and see the graph change depending on its value.
You can view the .twbx file here. Also, in the file I have included another type of gauge chart with arrow. I have taken this from Toan Hoang’s blog and customized it. <Refer Fig 11>
Concern
One concern I would like to address here is what if the positive percent change in KPI is not considered good. For example, an increase in Operating Expense can never be good. In that case, I would suggest swap the color to reflect the concern. Make the color of field ‘1. C’ as red and that of ‘1. A’ as blue or green.
Other reference material
With this we are done with this Gauge chart. I’m now including a few blog links by other authors on what else we can do or show with gauge charts.
1. https://www.flerlagetwins.com/2017/07/creating-nps-gauges-in-tableau_87.html by Ken Flerlage
2. https://tableau.toanhoang.com/gauge-chart-with-arrow/ by Toan Hoang
3. https://www.anmolparimoo.com/post/gauge-charts-speedometer-in-tableau-without-custom-data by Anmol Parimoo (the basis of my process).
4. https://www.anmolparimoo.com/post/nps-gauge-chart-tableau by Anmol Parimoo
In case your requirement is different, do read them and perform your own mix-match or improvise.