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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
zivhimmel
Resolver I
Resolver I

ALLEXCEPT help needed

Hi,

I'm trying to use Allexcept with a column on a dimension table and it looks to be ignored.

Let's say I have a sales fact table. Every record is for a sale and there's a customer satisfacion score.

Then we have a customer dimension. So there's 1:many relationship between fact sales and dim customer, using customer_id.

One of the columns in the customer dimension is city.

 

In a report page, I want to be able to filter down to a specific customer, see all of their sales, and show, side by side, the customer's

avg. satisfaction vs. the avg. satisfaction of customers from their city.

 

I tried something like the following but the city seems to be ignores and I just get avg. satisfaction accross all sales

 

avg_satisfaction_Same_city=

calculate(

AVERAGEX(ALL('Fact Sale'),'Fact Sale'[satisfaction]),ALLEXCEPT('Dim Customer','Dim Csutomer'[City])

)

 

Any idea?

Thanks.

 

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @zivhimmel ,

 

Would you please try to use the following measure:

 

avg_satisfaction_Same_city= CALCULATE(AVERAGE('Fact Sale'[satisfaction]),ALLEXCEPT('Dim Customer','Dim Csutomer'[City]))

 

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

 

Best Regards,

Dedmon Dai

View solution in original post

5 REPLIES 5
v-deddai1-msft
Community Support
Community Support

Hi @zivhimmel ,

 

Would you please try to use the following measure:

 

avg_satisfaction_Same_city= CALCULATE(AVERAGE('Fact Sale'[satisfaction]),ALLEXCEPT('Dim Customer','Dim Csutomer'[City]))

 

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

 

Best Regards,

Dedmon Dai

amitchandak
Super User
Super User

@zivhimmel , All except, mean all filter other than what you mentioned will be ignored.

 

refer: https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks @amitchandak . This is exactly what I want. I want to city of the customer to be respected (not ignored), but the customer filter to be ignored. I want to see all customers records from the same city as my customer. Happy to do it any other way, doesn't have to be ALLEXCEPT. Thanks.

@zivhimmel ,

Try like

calculate(

AVERAGEX(ALL('Fact Sale'),'Fact Sale'[satisfaction]),filter(allselected('Dim Customer'),'Dim Csutomer'[City] = max('Dim Csutomer'[City]))
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks again. It doesn't work however.

It returns an avg of all values, ignoring all filters. 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.