3

I would like to subtract promoters and detractors in Tableau by creating a new column. Thanks for all the help!

Customer Type Table (I would like to create the NPS field as shown below):

+---------+------------+----------+-----------+--------------+
| Quarter | Detractors | Passives | Promoters | NPS          |
+---------+------------+----------+-----------+--------------+
| Q1 15   | 40.56      | 23.56    | 35.79     | =35.79-40.56 |
| ...     | ...        | ...      | ...       | ...          |
+---------+------------+----------+-----------+--------------+
Andrew LaPrise
  • 3,373
  • 4
  • 32
  • 50
user1000730
  • 35
  • 1
  • 6

2 Answers2

3

Simply create a calculated field (called NPS):

[Promoters] - [Detractors]

This will add a new field to every row of your partition called NPS.

Check out the Tableau online help on calculated fields - this is a skill well worth learning.

Andrew LaPrise
  • 3,373
  • 4
  • 32
  • 50
  • Thanks Andrew, the trick is promoters and detractors are not separate columns / fields. they are fields of a single column - customer type – user1000730 Sep 24 '15 at 09:49
  • I'm not entirely sure I understand. Are you saying that you have a field called `Customer Type` that might say "Promotors" or "Detractors" and another field with the value? So all of those values would not be in the same row? You posted a table in your question showing something dramatically different. If the table above doesn't reflect what your data looks like, please update it accordingly. Once we know the shape of your data, I betcha we can solve this pretty quickly. – Andrew LaPrise Sep 24 '15 at 13:14
  • yes. you are correct, there is a field called customer type that may have detractors, promoters or passives. I could not update the table, can you also do that. Thanks Andrew! – user1000730 Sep 24 '15 at 14:26
  • Excellent. Please update the table in your question to reflect that! – Andrew LaPrise Sep 24 '15 at 14:27
  • And What could be the formula for that field? – user1000730 Sep 24 '15 at 14:29
  • I don't know yet, but I'm excited to figure it out once I see what your data looks like! – Andrew LaPrise Sep 24 '15 at 14:30
  • @user1000730, I edited your post to show the table as I believe you're describing it. Is this correct? If so, I have a solution for you. – Andrew LaPrise Sep 24 '15 at 14:42
  • @user1000730, actually, now that your question has been answered, you should probably just post a new question with what you actually want. You asked us to calculate NPS from the table you showed us, and we did so. It's too late to completely change the question at this point. I recommended that my edit be rejected. If you see it before that happens, I recommend that you reject it as well. Post a new question with your real data and real requirements, and we'll knock it out there. – Andrew LaPrise Sep 24 '15 at 14:57
  • 1
    That answer is outside the scope of your original question, and too long to post in the comments. We have to remember that this answer isn't just for you - SO is here to provide a library of answers for questions users might have in the future. Updating my answer to include the answer to a question you didn't ask would make for a very confusing library... I'd recommend accepting this answer (as it does correctly calculate NPS based on the table you gave us), then taking three minutes to ask a new question with your actual table. If that's really that distasteful to you then edit your question. – Andrew LaPrise Sep 24 '15 at 16:19
0

I understand the OPs question. The data comes in like this:

+---------+---------------+------+
| Quarter | Customer Type | Score| 
+---------+------------+---------+
| Q1 15   | Detractors    | 25   | 
| Q1 15   | Promoters     | 32   | 
| Q1 15   | Passives      | 45   | 
| Q1 15   | Detractors    | 17   | 
| Q1 15   | Detractors    | 28   | 
| ...     | ...           | ...  |
+---------+------------+---------+

And when brought into Tableau, the [Customer Type] field is put in the Column shelf and this arranges the data like the table below. The OP wants to calculate the [NPS] column (Promoters - Detractors).

+---------+------------+----------+-----------+--------------+
| Quarter | Detractors | Passives | Promoters | NPS          |
+---------+------------+----------+-----------+--------------+
| Q1 15   | 40.56      | 23.56    | 35.79     | =35.79-40.56 |
| ...     | ...        | ...      | ...       | ...          |
+---------+------------+----------+-----------+--------------+

I hope this clarifies. I am stuck with a similar situation (I want a column that shows the difference between 2015 and 2016):

+---------+-------+-------+------------+
| Measure | 2015  | 2016  | Difference |
+---------+---------------+------------+
| # Hires | 100   | 115   | 15         |
| # Terms |   9   |   6   | 3          |
+---------+---------------+------------+

I believe the steps are similar. I hope someone can help.

yake84
  • 3,004
  • 2
  • 19
  • 35