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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.