简体   繁体   中英

Pivot table calculate field based on grouped values

after years of quietly learning from this site I've finally hit a question who's answer I cannot seem to find on StackOverflow...


I have a pivot table that needs to calculate Net Promoter Score from several groups within a population.

Net promoter score is calculated like so:

[% of Population that give 9 or 10/10] - [% of Population that give 1 to 6/10]

Each individual record in my source data can only have a single Score of between 1 and 10:

RAW DATA:
Date (dd/mm)    Country    Type         Score (1-10)    NPS Category
01/05           US         Order enq.   9               Promoter
13/05           US         Check-out    5               Detractor
28/05           US         Order enq.   7               Passive

So, with help from the answers below I've added a column to categorise each individual into the Promoter (9 or 10), Passive (7 or 8) and Detractor (1 to 6) groups based on that score: screenshot of raw data (with sensitive items hidden).

All that remains now is: How can I create a calculated 'NPS' column like the one shown in my (rudimentary) representation of a pivot table below that takes the Detractor value from the Promoter value?

D = Detractor group
Pa = Passive group
Pr = Promoter group


      |     Order enquiry    |      Check-out      |
      | D    Pa   Pr   NPS   |  D    Pa   Pr   NPS |
-------------------------------------------------- |
GB    |                      |                     |
  May |  0    0  100    100  | 30    20    50   20 |
  Jun | 10   30   60     50  | 35    35    60   25 |
  Jul | 30   20   50     20  | 40    10    40    0 |
US    |                      |                     |
  May | 45   15   40    - 5  | 50    10    40  -10 |
  Jun | 40   30   30    -10  | 40    30    30  -10 |
  Jul |  5   35   60     55  | 20    40    40   20 |

My attempt at a calculated column can be seen in this screenshot . This results in an error and of course I haven't managed to convert the NPS counts into percentages yet.

It would be my suggestion to create a new column in the source that calculates D , Pa , Pr by a formula.

You can now create the % for these values in the pivot. The NPS column can either be calculated after pivoting the output field, or by creating a pivot-column formula in Excel.

It's not clear from your question how your data is laid out, or what exactly you're asking. From what I can see, you need to add a column in your raw data table, which says something like

=COUNTIFS(UniqueID,MyUniqueID,Score,">=9")-COUNTIFS(UniqueID,MyUniqueID,Score,"<=6")

Then another column that says

=IF(NetPromoter>=9,"Pr",IF(NetPromoter>=7,"Pa","D"))

And then in your pivot table you add the Classification as a new subcolumn, and add the NPS as the Average of your NPS column, or something like that.

Please show your data if you want the formulas changed to meet your actual range/variable terms.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM