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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Slicer and measure using same column

Hello, 
I am almost certain that this isn't how PBI was working before, but anyways, how can I avoid this behaviour? 

Example table: 

MatejK_0-1626700787077.png

Measures: 

londons = CALCULATE(COUNT('Table'[country]),'Table'[city] = "london")
rows = COUNT('Table'[city])
Unfiltered version: 
MatejK_1-1626700835674.png

 

If I filter by city, to be just "dublin", why do I still have in "londons" measure value 1 instead of 0/ blank? 

MatejK_2-1626700882844.png

How can I make it 0? 

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

Hey @Anonymous ,

 

you override the filter context with:

 

'Table'[city] = "london"

 

 

So it doesn't matter what you choose, you always override it with London. And that was always like that.

If you don't want that, remove that part of the formula.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@Anonymous If I am not mistaken, this is a case of your filter context being executed before your query context, which I am pretty sure that's how it has always been.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
selimovd
Super User
Super User

Hey @Anonymous ,

 

you override the filter context with:

 

'Table'[city] = "london"

 

 

So it doesn't matter what you choose, you always override it with London. And that was always like that.

If you don't want that, remove that part of the formula.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
Anonymous
Not applicable

I see, I completely forgot that if I want to have it filtered by both (slicer and measure) I have to use FILTER

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors