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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Josh0112
New Member

Simple DAX Query Question

I'm trying to create the following measure. I have two columns, one is a score and one is a text response. Like below

 

NPS     Theme

100        good

0            good

-100       bad

100        other

100        bad

100        fun

 

I want to be able to create a table that can show what the average of the NPS column would be if we didn't include each of the specific text themes. Something like below. Example for good theme would be (-100+100+100+100)/4

 

Theme   Average of NPS when theme not included

good        50   

bad          75

other        40

fun           40

 

Just not sure where to start with this one. Any help would be greatly appreciated. 

1 ACCEPTED SOLUTION
vicky_
Super User
Super User

This DAX measure worked for me:

 

Average of NPS when theme not included =
var themeNotIncluded = FILTER(ALL('Table'), 'Table'[Theme] <> SELECTEDVALUE('Table'[Theme]))
return AVERAGEX(themeNotIncluded, 'Table'[NPS])

 

View solution in original post

6 REPLIES 6
Dangar332
Super User
Super User

Hi, @Josh0112 

 make new table and use below code

 

new table = SUMMARIZECOLUMNS(yourtable[theme],
                              "s",CALCULATE(AVERAGE(yourtable[nps]),
                                          yourtable[theme]<>SELECTEDVALUE(yourtable[theme])
                                          )
                            )
 
Dangar332_0-1696395274790.png

here s = Average of NPS when theme not included

 


If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

vicky_
Super User
Super User

This DAX measure worked for me:

 

Average of NPS when theme not included =
var themeNotIncluded = FILTER(ALL('Table'), 'Table'[Theme] <> SELECTEDVALUE('Table'[Theme]))
return AVERAGEX(themeNotIncluded, 'Table'[NPS])

 

Thanks, this seemed to do the trick. 

Nice! Glad to help

ChiragGarg2512
Super User
Super User

@Josh0112 , Explain the issue properly.

Can you let me know what additional information i could include to sufficiently explain?

 

In short i'm trying to create a measure which is AVERAGE(NPS) but to somehow use the discrete text combinations in theme column (good, bad, other, fun) as an exclusion filter. Each row has a unique id assigned to it so can be treated as a single response in a survey. E.g. first person gave a score of '100' and a theme of 'good' , second person gave a score of '0' and a theme of 'good' etc. 

So when i drop this in to a table against the theme 'good' in the theme column i want it to show the average of NPS for all themes combined except for the nps scores associated to the responses that answered 'good'. In the example i provided this would mean that the average of all NPS scores excluding the ones with text response 'good' = -100 (bad) + 100 (other) + 100 (bad) + 100 (fun) / 4 = 50

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.