cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MatejK
Helper I
Helper I

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
Community Champion
Community Champion

Hey @MatejK ,

 

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 IV
Super User IV

@MatejK 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!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




selimovd
Community Champion
Community Champion

Hey @MatejK ,

 

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

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
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

Get Ready for Power BI Dev Camp

Power BI Dev Camp - September 30th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.