---
title: .nps()
slug: nps
docTags: 
createdAt: 2021-09-14T18:35:54.000Z
---

Calculates a [Net Promoter Score](https://en.wikipedia.org/wiki/Net_promoter_score) from a [Sequence](docId\:JG4itlQWafzLpArttFo67) or [List](docId\:xWH_cUkHj9waqaEfb7H71).

Net Promoter Score is calculated by taking the number of Promoters (values of 9 or 10), subtracting the number of Detractors (values of \<= 6), and dividing by the total number. The result is multiplied by 100 and therefore will be between -100 (worst) and 100 (best).

This is especially useful in calculating eNPS (Employee Net Promoter Score).

### Syntax

`.nps()`

- Returns the NPS score of items in the Sequence or List.

`.nps{expression}`

- Returns the NPS score of items in the Sequence or List evaluating`expression` for each item.

### Examples

- `[4, 8, 9, 10].nps()` returns `25`
- `findAnswers('eNPS Question', '-30d').nps{it.value}` returns the eNPS score from all of the responses to the `eNPS Question` question in the past 30 days.
- `findAnswersByAssessment('eNPS Question', '2H Engagement Survey').groupBy{submitPerson.department}.nps{it.value}` returns the eNPS score from all the answers to the `eNPS Question` in the `2H Engagement Survey`, grouped by department.

