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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. 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
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors
Top Kudoed Authors