Ads Top

Creating NPS Gauges in Tableau

This weekend, Rajeev Pandey, a former Tableau Featured Author and regular in the Tableau community, posted a question on the Tableau Community forum asking if anyone had ever created a gauge to show Net Promoter Score. Here’s the image he shared.

He also reached out to me directly to see if I could help, so I figured why not give it a go.  

What is NPS?
Before jumping into how to create this gauge in Tableau, let’s start with an explanation of NPS. According to, “The Net Promoter Score is an index ranging from -100 to 100 that measures the willingness of customers to recommend a company’s products or services to others. It is used as a proxy for gauging the customer’s overall satisfaction with a company’s product or service and the customer’s loyalty to the brand.” I won’t go into detail about how NPS is calculated, but if you’d like to learn more, you can check out the Medallia’s full explanation.

While there are a number of different ways to visualize this metric, one of the most common seems to be a sort of gauge as seen in the image above.

The Chart
Let’s start with some observations about this chart.
  • First of all, it looks basically like a half of a donut chart (and donut charts in Tableau are essentially pie charts with a hole in the middle).
  • The first slice of a pie chart in Tableau always starts at 0°, but this chart would need to start at 270°.
  • The values of the chart will need to go from -100, starting at 270°, to 100, ending at 90°.

So, how to create it? The biggest challenge of this chart is the fact that it needs to start at 270°. I decided that my approach would be to create a donut chart with 5 pre-defined slices, as shown below.

  • Slice 1 – Variable sized slice starting at 0° and ending between 0° and 90°. This slice will be used to show the second part of the NPS (if the value is greater than 0). Otherwise, this slice will have 0 size, making it invisible.
  • Slice 2 – Variable sized slice starting and ending somewhere between 0° and 90°, after slice 1. If NPS is less than 100, then this slice will be visible and will appear in a light grey color.
  • Slice 3 – Hidden slice starting at 90° and ending at 270°. This slice will always be 180° and will always be the same color as the background, rendering it invisible, essentially making it a half-donut.
  • Slice 4 – Variable sized slice starting at 270° and ending between 270° and 360°. This slice will be used to show the first part of the NPS (values between -100 and 0).
  • Slice 5 – Variable sized slice starting and ending somewhere between 270° and 360°, after slice 4. If NPS is less than 0, then this slice will be visible and will appear in a light grey color, like Slice 2.

Using this relatively simple idea, I created a very small data set containing five records, one for each slice, with the following information about each:
  • Slice # – Numeric identifier of the slice (1, 2, etc.)
  • Slice – Name of the slice (Slice 1, Slice 2, etc.)
  • Details – Description of the slice and how it’s used.

Strictly speaking, we could get by with just Slice # in the data set, but I decided to add a bit more information to make it less confusing to someone using the template.

Notice that there are no measures in the data set. We’ll create the measure within Tableau, based on the NPS score. Note: I’m assuming that the user will have an NPS score which can be fed to the visualization. For demonstration purposes, I’ll just create a parameter allowing the user to select an NPS.

The Calculations
Calculating the pie chart size measure is a matter of some relatively simple math. To simplify my formulas, I created five calculated measures, one for each slice. Here are the formulas for each.

Value_Slice_1:  IF [NPS]>0 THEN [NPS] ELSE 0 END
Value_Slice_2:  IF [NPS]>0 THEN 100-[NPS] ELSE 100 END
Value_Slice_3:  200
Value_Slice_4:  IF [NPS]<0 THEN 100+[NPS] ELSE 100 END
Value_Slice_5:  IF [NPS]>0 THEN 0 ELSE 100-[Value_Slice_4] END

Note: “NPS” is the name of the parameter noted earlier.

Then, I combined these values into a single measure, which I called Chart Value:

CASE [Slice #]
WHEN 1 THEN [Value_Slice_1]
WHEN 2 THEN [Value_Slice_2]
WHEN 3 THEN [Value_Slice_3]
WHEN 4 THEN [Value_Slice_4]
WHEN 5 THEN [Value_Slice_5]

Finally, I created a calculated field called Color:

IF [Slice #]=3 then "None"
ELSEIF [Slice #]=5 OR [Slice #]=2 THEN "Grey"
ELSEIF [NPS]>[Highest Normal Value] THEN "Green"
ELSEIF [NPS]>[Highest Bad Value] THEN "Yellow"
ELSE "Red"

Note: This formula references two other calculated fields, Highest Normal Value and Highest Bad Value, which refer to the maximum “Yellow” NPS score and the maximum  “Red” NPS score respectively. In this case, I’ve used values 60 and 20 per Rajeev’s requirement.

Next, based on these calculations, I created a very simple pie chart, as shown below:

I then changed to a dual-axis chart, with the second axis showing a manually sized white circle.

Note: I’ve colored the NPS score the same color as the gauge. Doing this required that I create three separate calculated fields as follows:

Value_Bad:  IF [NPS]<=[Highest Bad Value] then [NPS] END
Value_Normal:  IF [NPS]>[Highest Bad Value] and [NPS]<=[Highest Normal Value] then [NPS] END
Value_Good:  IF [NPS]>[Highest Normal Value] then [NPS] END

I then combined those into the Label as follows: <Value_Bad><Value_Good><Value_Normal>. As only one of these calculated fields can have a value, you’ll only ever see one color.

With that complete, I had the basic NPS chart in place.

But, I was missing one key component. The original chart had a small key right below the gauge showing where the values would change from red to yellow to green.
So, how do we create this? I experimented with a few different options, but all seemed to require use of a dual-axis and, since I was using the dual axis for the hole in my donut, I could not find a way to make it work. In the end, I decided that the best approach would be a custom image with a transparent background, which would float over the pie on a dashboard. While I’d definitely prefer not to having to piece together floating elements to make the chart work, I just couldn’t find any other way (If anyone reading this has another idea, I’d love to hear it.)

Since I would be floating an image on top of the chart, I decided to just use the image to double as my donut hole. The image I ended up creating (using mostly PowerPoint and a little Paint.NET) looks like this (the checkered background indicates transparency).

With this element acting as the donut hole, I removed my dual axis and the center circle, taking it back to the original pie chart. 

From here, it was just a matter of adding the pie to a dashboard and floating the image over top of it. Finally, I added one more sheet to display the actual NPS value, which was then floated over top of the image. 

Here’s the final result:

Required Files
If you have a need to create a gauge like this, then feel free to download my examples from Tableau Public. You can also find the Excel template here and the image here. If your customer requires different ranges for bad, normal, and good, then that will require some slight changes to the image. In addition, if you need to change colors (yes, I know that traffic light colors aren’t necessarily the best option), then you can fairly easily recolor the image.

Update 09/05/2017: New Approach!
The other day, I saw the following comment on this blog post, from Sr. Tableau Developer, Tim Hughes (check out his Tableau Public Profile):

Very cool, Ken!

Instead of floating the key image over the donut, I think it would work to instead

1. Make the key image a full circle with the bottom half white
2. Save the image as a custom shape in your Tableau repository shapes folder
3. Change your second mark card from a white circle to that custom shape (keeping the existing label)


Okay, so this is a great idea. Essentially, he's suggesting that we dispense with the floating image, go back to our original dual-axis approach and simply replace the white circle with a custom shape. So, I created the image as he suggested. Here's how it looks (again, the checkered area indicates transparency):

As Tim suggested, I created this as a custom shape in my Tableau repository. I then went back to the original NPS chart and changed the white circle to use this custom shape. And here's the result:

Obviously, it looks exactly like my previous version. However, this is a much more elegant solution as it does not require you to float an image over top of the chart. Thanks a lot for the tip Tim!! If you'd like to try this method out, you can find the full circle image here.

Update 09/27/2017: Some Alternatives to NPS Gauges
Since writing this blog post, something has been nagging at me—I’m just not sure that this is really the best way to visualize this data...Read more here: Alternatives to NPS Gauges

Ken Flerlage, July 25, 2017.


  1. Ken,
    Being novice in Tableau, I wasn't able to create the pie chart exactly as displayed. Mine looked like a full pie chart as opposed to the 'half moon' you had created. Am I missing something simple?

    1. Mine's a full pie chart as well. I've just colored the bottom half (slice 3) white so that it blends into the background, making it invisible.

  2. Great tutorial for building an NPS guage. I'm currently doing something a little different (converting the scale of -100 to 0 to 100) for any kind of value or metric to display (counts of something, percent progress, etc.), but my greatest question has to do with "how did you remove the wedge highlighting when the mouse hovers over the gauge?" I cannot figure this out for the life of me. I am currently using a professional license for v10.1.3. Thank you for any assistance you may offer!

    1. Simple trick--just float a Blank over top of it. It will prevent users from interacting with the pie.

  3. This is great Ken. I'm not a fan of NPS, nor Gauges...but still find this to be incredible work and I'm certain this will be useful for many.

    1. I'm not a big fan either :) But people do naturally understand them as they are used everywhere in our lives (cars, in particular), so they can be a good gateway for people not familiar with more appropriate ways to visualize the data.

  4. Ken, this is awesome! I tried to replicate and the pie kept looking like it was on it's side and then I realized that my dimensions/measures on the marks were not in the same order as what you had (I had them ordered Color (on color mark), Avg(Chart Value) (on angle), Slice (on detail)) so when I re-ordered them to look like your workbook (Slice (on detail), Color (on color), Avg(Chart Value) on angle) the chart flipped back to what it should look like. Can you explain why the order of the marks has this impact?

    1. Glad you found it valuable. The order of the pills on the marks card defines the precedence in the sorting hierarchy. So, by moving Slice to the top, it took precedence on the sorting.

      This blog post explains a little further:

  5. Hi Ken,

    I'm trying to use an NPS calculated from a different data source (my NPS results source) but it is struggling to work. When I use the measure from a different data source instead of the NPS parameter it many of the calculated fields don't work as it wants to aggregate the values.

    Any idea on how to get around this?

    1. Apologies, Ryan. I just now noticed this comment. See my response to Dylan below. I hope this should put you on the right track.

    2. Definitely a lot closer! I still can't get the colour to work as it doesn't like the NPS value being calculated as an aggregate.
      (doing SUM(IF [NPS] >=9 THEN 1 ELSE 0 END)
      SUM(IF [NPS] <=6 THEN 1 ELSE 0 END)

      I've tried playing around with the INCLUDE LOD to get in the customer but don't feel like it is the right approach?

      Any suggestions for getting the colour to work properly if the NPS is an aggregated number?

    3. Take a look at this workbook:
      The data is here:

      Mine assumes that you are averaging a set of NPS scores, but if the operation were something other than average, then you'd just switch AVG for whatever else you're using.

  6. Very cool, Ken!

    Instead of floating the key image over the donut, I think it would work to instead

    1. Make the key image a full circle with the bottom half white
    2. Save the image as a custom shape in your Tableau repository shapes folder
    3. Change your second mark card from a white circle to that custom shape (keeping the existing label)

    If you give it a try, let me know if it works. I didn't bring my computer with me this weekend to check it myself.


    1. That's a fantastic idea. I'll give it a try.

  7. Hey Ken, how would you tie this in with a blended data set so that instead of using a parameter to determine the NPS score you a customer dataset and maybe NPS would be an aggregated value from that set. The user would be able to choose the customer from a drop down filter and see a view about that customer with the NPS guage being one item in the view?

    1. You'd need do do the following:

      1) Join your data set with my data template. You can create a field called "Link" with the same value for each record in each data set.
      2) Replace all references to the NPS parameter with the NPS value from your data set.
      3) You'll want to add a filter so that it only shows a single customer.

      Here's a workbook with some sample data in it:

      And here's the source data I used:

      I hope this helps. Sorry, I'm just now seeing your comments.

    2. Thanks Ken Ive got it working now! Now if only tableau would allow me to set some of the slices to an assigned color and others to a scale....


    3. Ken, you used the data in excel, I am using a .tde relating to excel, but it has not worked, can you help me? Always an aggregation value error when I make the data relation.

    4. Can you send me your .tde and workbook?

  8. Very nice! Do you have a sample or a modification to this that will set a 0 value at 270 deg, 50 at 0 deg, and 100 at 90 and fill appropriately? Or one that looks more like a spedometer?

    1. Not exactly sure what you're asking. Do you have an example?

      There are lots of good examples of speedometer-type charts in Tableau. Adam McCann has some good posts on gauges here: But I'd also recommend you read my latest post on visualizing NPS. You may find that another chart type will work much better (and be much easier to create) than a gauge.


Powered by Blogger.