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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.