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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
lucazanzi
New Member

ALLEXCEPT but keep a set filter as well

Hello everyone,

This has probably been asked before with a different phrasing, so thank you and apologies in advance!

Let's say my data looks like this:

ItemStoreCityStock
AHigh StreetLondon3
ALow StreetVancouver7
AMain StreetBoston3
BJubilee StreetToronto5
BFun StreetRome7
CLow StreetVancouver3
CHigh StreetLondon4

 

And my report shows the above data in various visuals (ex: Item count by City, number of stores by City, Distinct products by store, total stock by store/city, etc...).

I would like to create a Measure that:
1) SUMS the Stock
2) Item == A
3) Filters based on City if selected (ie: if you click on a City in a visual, the Measure is affected)
4) Does not filter based on anything else (ie: if you click on a Store in a visual, the Measure is not affected).

I suspect there's an ALLEXCEPT involved, but I have not been able to get it to work. Any hints? 
 

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

Hi @lucazanzi,

 

You can try this method:

New a measure:

Total =
CALCULATE (
    SUM ( 'Table'[Stock] ),
    ALLEXCEPT ( 'Table', 'Table'[City] ),
    FILTER ( 'Table', 'Table'[Item] = "A" )
)

And the result is:

vyinliwmsft_0-1669184592793.png

vyinliwmsft_1-1669184601573.png

 

 

Hope these help you.

Here is my PBIX file.

 

Best Regards,

Community Support Team _Yinliw

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

View solution in original post

3 REPLIES 3
v-yinliw-msft
Community Support
Community Support

Hi @lucazanzi,

 

You can try this method:

New a measure:

Total =
CALCULATE (
    SUM ( 'Table'[Stock] ),
    ALLEXCEPT ( 'Table', 'Table'[City] ),
    FILTER ( 'Table', 'Table'[Item] = "A" )
)

And the result is:

vyinliwmsft_0-1669184592793.png

vyinliwmsft_1-1669184601573.png

 

 

Hope these help you.

Here is my PBIX file.

 

Best Regards,

Community Support Team _Yinliw

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

FreemanZ
Super User
Super User

you may also try
Measure =
CALCULATE ( 
    SUM ( Data[Stock] ), 
    ALL ( Data), 
    VALUES(Data[City])
 )
tamerj1
Super User
Super User

Hi @lucazanzi 

yes you are right. You csn use

=
CALCULATE ( SUM ( Data[Stock] ), ALLEXCEPT ( Date, Data[City] ) )

Alternatively, you can replace ALLEXCEPT with REMOVEFILTERS ( ), VALUES ( Date[City] )

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.