Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Calculate Net Promoter Score in Vega Lite

Topic Labels: Extensions
Solved
Jump to Solution
1386 4
cancel
Showing results for 
Search instead for 
Did you mean: 

I’m trying to calculate and then visualize Net Promoter Score (NPS) from a table of evaluation scores submitted through a form.

NPS = (% promoters - % detractors) / total number respondents

Where:
promoter values = 9-10
detractor values = 1-6
total respondents = 1-10

I’m new to Vega and got stuck pretty quickly. I’m pretty sure I need to do a calculate transform step, but not sure how to assign e.g. “promoter” to values of 9 and 10. Is binning the approach, or is there some conditional logic that could work?

I’m interested in ways to do this without Vega as well, but I like not having to add extra fields to my table if it is possible to do the calculation within the app module.

Thanks in advance for any assistance!

1 Solution

Accepted Solutions

Figured it out. The key was to transform values [promoter, passive, detractor] into a score [+1, 0, -1] and use “joinaggregate” to create a sum_score that effectively equals the “promoters - detractors” bit of original equation. Rest was easy. Now to make it look pretty!
image

See Solution in Thread

4 Replies 4

Decided to add an extra field in Airtable that uses conditional logic to assign “promoter”, “detractor” and “passive” values when appropriate number in the “NPS” field.

Now just need to figure which are the appropriate transforms in Vega-lite (I think)

I can probably help a little with this, but I’m totally slammed for the week.

Thanks for the response, Bill! I’m going to continue to tinker with it when I get the time. Will post any updates to the thread.

Figured it out. The key was to transform values [promoter, passive, detractor] into a score [+1, 0, -1] and use “joinaggregate” to create a sum_score that effectively equals the “promoters - detractors” bit of original equation. Rest was easy. Now to make it look pretty!
image