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
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

Top Solution Authors