Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
wmcclure
Helper I
Helper I

NPS Score needs additional filter

Hello all!

 

I have a DAX formula in place for calculating NPS score based on information that customers provide. I need to add some logic to make sure that NPS is only calculated once per customer assessment (There can be multiple products, so this will duplicate the NPS score for customers that have more than one. 

 

The current formula is as follows: 

NPS Score =

  VAR ResponseCount = COUNTA(assessment_records[nps_score])

  VAR PromoterCount = COUNTAX(FILTER(assessment_records, [nps_score] >= 9), [nps_score])

  VAR DetractorCount = COUNTAX(FILTER(assessment_records, [nps_score] <= 6), [nps_score])

 

  VAR Score = 0 + (PromoterCount - DetractorCount) / ResponseCount * 100

 

  RETURN IF(NOT(ISBLANK(ResponseCount)), Score)

 

- The logic that needs added is to only count the Non-Blank NPS score ratings once per assessment_records[uuid]

 

I think I just need to use the "DISTINCT" function but i get errors in the positions that I try to put it in.

 

Thanks in advance! Let me know if I need to provide more details, but I hope that this is a simple fix that I am just overlooking

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @wmcclure ,

I apologize for not responding to your message until now.The Table data is shown below:

vzhouwenmsft_0-1713750627359.png

Please follow these steps:
1. Use the following DAX expression to create a measure

NPS Score = 
 VAR ResponseCount = COUNTROWS(SUMMARIZE('Table','Table'[uuid]))
 VAR PromoterCount = COUNTROWS(FILTER(SUMMARIZE('Table',[uuid],"Score",MAX('Table'[NPS Score (Our Company Score)])),[Score] >=9))
 VAR DetractorCount = COUNTROWS(FILTER(SUMMARIZE('Table',[uuid],"Score",MAX('Table'[NPS Score (Our Company Score)])),[Score] <= 6))
 VAR Score = IF( ResponseCount >0 ,(0 + (PromoterCount - DetractorCount) / ResponseCount * 100),BLANK())

  RETURN IF(NOT(ISBLANK(ResponseCount)), Score)

2.Final output

vzhouwenmsft_1-1713750716122.png

 

View solution in original post

4 REPLIES 4
wmcclure
Helper I
Helper I

This is a quick version of the data with the expected results included

uuidDeal NumberDeal DomainCustomerManufacturerCSAT Score (Manufacturer Score)NPS Score (Our Company Score)Prmotor or detractor?
106124500Public CloudRedactedRedacted510p
104133934Digital WorkspaceRedactedRedacted310p
103134539Data CenterRedactedRedacted36d
103137171Data CenterRedactedRedacted36DUPLICATE
45133190Data CenterRedactedRedacted310p
44133745Data CenterRedactedRedacted48 
43129736Digital WorkspaceRedactedRedacted310p
43132535Digital WorkspaceRedactedRedacted310DUPLICATE
4299732Public CloudRedactedRedacted510p
42141020Enterprise NetworkingRedactedRedacted510DUPLICATE
41119798Public CloudRedactedRedacted410p
40132026Digital WorkspaceRedactedRedacted510p
        
Response Count9     
Promotor Count7     
Detractor Count1     
        
Expected NPS Score                                     0.67     
Anonymous
Not applicable

Hi @wmcclure ,

I apologize for not responding to your message until now.The Table data is shown below:

vzhouwenmsft_0-1713750627359.png

Please follow these steps:
1. Use the following DAX expression to create a measure

NPS Score = 
 VAR ResponseCount = COUNTROWS(SUMMARIZE('Table','Table'[uuid]))
 VAR PromoterCount = COUNTROWS(FILTER(SUMMARIZE('Table',[uuid],"Score",MAX('Table'[NPS Score (Our Company Score)])),[Score] >=9))
 VAR DetractorCount = COUNTROWS(FILTER(SUMMARIZE('Table',[uuid],"Score",MAX('Table'[NPS Score (Our Company Score)])),[Score] <= 6))
 VAR Score = IF( ResponseCount >0 ,(0 + (PromoterCount - DetractorCount) / ResponseCount * 100),BLANK())

  RETURN IF(NOT(ISBLANK(ResponseCount)), Score)

2.Final output

vzhouwenmsft_1-1713750716122.png

 

Anonymous
Not applicable

Hi @wmcclure ,

Regarding your question, try the following expression.

NPS Score =
  VAR _a = COUNTROWS(DISTINCT(assessment_records[uuid]))
  VAR ResponseCount = COUNTA(assessment_records[nps_score])

  VAR PromoterCount = COUNTAX(FILTER(assessment_records, [nps_score] >= 9), [nps_score])

  VAR DetractorCount = COUNTAX(FILTER(assessment_records, [nps_score] <= 6), [nps_score])

 

  VAR Score = IF( _a >0,(0 + (PromoterCount - DetractorCount) / ResponseCount * 100),BLANK())

 

  RETURN IF(NOT(ISBLANK(ResponseCount)), Score)

If my understanding is wrong, please provide simple example data and show the expected result as a picture.

 


Best Regards,
Wenbin Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Unfortunately, it looks like that has no effect on the result. 

 

uuid refers to the assessment that is input by our employees. The customer is asked about their individual products as well as about the service that our company provides. When the customer has more than one product that we are asking about, it causes multiple lines of NPS (our company's score) to be in the data. Therefore, we only want to count NPS once per assessment. We arent counting the uuid, we just want to make sure that NPS score isnt counted multiple times for a single uuid entry.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.