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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
daglite
Frequent Visitor

dax filter question, many to one

dax filter question, many to one

Why does in this scenario the filter appears to go from the many to the one side?

Everything I've read stated that the filters flow down hill from the one side of the relationship to the many side of the relationship.

 

Lets say I have two tables.

foo    bar
a       a  | b
--      -- | ------
1       1  | red
2       1  | green
        2  | blue
        2  | yellow

And two measures.

count foo = COUNTROWS(foo)
count foo filtered = CALCULATE([count foo], bar) 

When I cerate a 'Card' for each measure.

If I place a page level filter on

column 'b' of table 'bar'
and filter to color 'red'

 

Why does the Card with 'count foo' show 2 and the card with 'count foo filtered' show 1

I would expect both of the measures to return 2

since the filter is being applied to table 'bar'

which has a many to one relationship to table 'foo'

Instead 'count foo' still returns 2 but 'count foo filtered' now returns 1.

1 ACCEPTED SOLUTION

I modeled this out and achieved the same results that you did. Switching the filter direction to Both caused both of the measures to act the same way when filtering by "red" (1). The only thing I can figure is that deep down in the bowls of DAX, including the filtered table in the calculation is creating an implicit relationship between them when doing the calculation even though your filter direction is not setup that way explicitly.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
Greg_Deckler
Community Champion
Community Champion

Perhaps try changing your filter direction to bi-directional?



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks for the reply smoupre.

 

The weird thing is that this many to one side filtering appears to be working without bi-directional filtering...

 

I'm was just hoping that someone would help me understand how that is possible.

From your description, the filtering is working from the One-to-Many direction and not the Many-to-One direction. I'll recreate but from what I see going on is that your first measure only includes the context of "foo". When you filter to red, because the relationship is only setup from one-to-many and not from many-to-one then the count of foo is 2 because nothing is filtering the table.

 

Now, when you add a CALCULATE and you include the context of "bar", then your filter applies to "bar" and thus it is calculating the count of "foo" in the context of the filter of a single "bar" value.

 

I'll recreate this and test but I think this is essentially what is going on.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

I modeled this out and achieved the same results that you did. Switching the filter direction to Both caused both of the measures to act the same way when filtering by "red" (1). The only thing I can figure is that deep down in the bowls of DAX, including the filtered table in the calculation is creating an implicit relationship between them when doing the calculation even though your filter direction is not setup that way explicitly.



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks, that has to be it.

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.

Top Solution Authors