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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
prady2581
Helper I
Helper I

NPS CALCULATION QUERY ON FILTER CONTEXT

Formula used for nps calcuation is as below, want to check whether it is appropriate to use ALL/ALLSELECTED/ALLexcept in the end. In the power bit report i have slicers by region, department, etc and i use this measure in table matrix view. Im not able to visual what is the impact of making use of this above function and without it. Appreciate if any explaination on this aspect in terms of actual use case.

 

NPSScore = var Promotercount = [Promoter count]
var Passivecount = [Passive count]
var Detractorcount = [Detractor count]
var Nu = Promotercount - Detractorcount
var Dn = [Total surveys]
Var Result = DIVIDE( Nu, Dn )*100
Return
CALCULATE(Result, REMOVEFILTERS('Raw data')
)
5 REPLIES 5
DanielGarcia
Advocate I
Advocate I

Good morning, man!

 

So, maybe this can help you with examples:

https://community.powerbi.com/t5/Community-Blog/The-ALL-ALLSELECTED-amp-ALLEXCEPT-Code/ba-p/1019987

 

But basically this functions make filters in another tables that have relation with the measure that you create.

 

Example: Do you need to calculate the NPS of this year, but in the visual do you have one slicer that filter a mouth… For ignoring this slicer and keep filtering the NPS of this year, you can use the function “REMOVEFILTER” of the table calendar, with this you are “ignoring” the slicer on the mouth.

Thanks Daniel. The matrix table has rows by client name, column fieds has month fiscal-year it should consider the filter context row and column and any of the defaul context from slicers. Do I need to use allselected in this case. 

Depends, if you want that the slicers change this measure, you don't need to use this functions… Your formula could be like that:

 
NPSScore = var Promotercount = [Promoter count]
var Passivecount = [Passive count]
var Detractorcount = [Detractor count]
var Nu = Promotercount - Detractorcount
var Dn = [Total surveys]
Var Result = DIVIDENuDn )*100
Return Result

But if you need that the measure don't change with the slices, yes, use the function allselected
 
Try the two options and validate the results.
 

Thanks daniel, I;ll check both options and see it matches my requirement.

You're welcome friend, anything, I'm at your disposal.

If I have a positive result, could you mark this question as resolved?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.