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
ksahil16
Frequent Visitor

Issues with Filtering Across Indirect Relationships in Power BI between two tables

I'm having trouble with filtering across multiple tables where there's an indirect relationship, and I'd appreciate some guidance on how to fix this. Here's my setup:

Food Entities - Table showing the metions of food and its associated published on date

IdFoodPublishedon
1Apple25-01-2024
2Pear26-02-2024
3Apple26-02-2024
4Banana26-02-2024
5Banana28-03-2024

 

Intermediate table - Table to create a connection between Food entities table and Relation Association table 

Intermediate table
Apple
Pear
Banana

 

Relation_Association - Table showing when a Food and contaminant and mentioned together and its associated PublishedOn date

IdFoodContaminantPublishedOn
1AppleCont A25-01-2024
2AppleCont B26-02-2024
3AppleCont A26-02-2024
4BananaCont C28-02-2024
5PearCont B01-03-2024
6BananaCont A02-03-2024
7BananaCont C02-03-2024


NOTE: The Food_Entities table and the Relation_Association table are connected to each other using a bidirectional relationshipo through the Intermediate table.


My main goal is to create two table visuals- First one where I display the Food and the its counts based on the "PublishedOn" filter from Food Entities table, and the second table which also gives me the Count of the Contaminant column from the Relation_Association table. 

So for example if I apply the filter for the PublishedOn column and select the date 26-02-2024 and everythign after that. My first table should display:

Visual Table 1: 

FoodCount
Apple1
Pear1
Banana2


Visual Table 2:

ContaminantCount_contaminant
Cont A2
Cont B2
Cont C2


And the Count_contaminant column values should also change on the filter PublishedOn from the Food Entities table.

What I tried:
Measure I created for Count_contaminant: 

Count_contaminant = CALCULATE(
    COUNT('Relation_Association'[food]),
    'Food_Entities'[published_on]
)



when I apply a filter on the published_on column in the Food_Entities table, it doesn't seem to affect the result of this measure. The data in Relation_Association remains unaffected by the date filter.

How can I modify the measure or the relationships to ensure that the filter applied on Food_Entities[published_on] affects the count of food entities in Relation_Association?

Do I need to change the relationship settings or write a more complex measure to ensure the filter propagates properly through the intermediate table?

Any help would be appreciated.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @ksahil16 ,

 

Please create a new calendar table:

Calendar = 
CALENDAR (
    MIN (
        MIN ( 'Food_Entities'[Publishedon] ),
        MIN ( 'Relation_Association'[PublishedOn] )
    ),
    MAX (
        MAX ( 'Food_Entities'[Publishedon] ),
        MAX ( 'Relation_Association'[PublishedOn] )
    )
)

vcgaomsft_0-1728614020029.png

Two-side relationships should be avoided in the model as much as possible, and if needed please turn them on in the code:

Count_contaminant = 
CALCULATE (
    COUNT ( 'Relation_Association'[food] ),
    CROSSFILTER ( 'Intermediate table'[Intermediate table], 'Food_Entities'[Food], BOTH )
)

vcgaomsft_1-1728614181159.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @ksahil16 ,

 

Please create a new calendar table:

Calendar = 
CALENDAR (
    MIN (
        MIN ( 'Food_Entities'[Publishedon] ),
        MIN ( 'Relation_Association'[PublishedOn] )
    ),
    MAX (
        MAX ( 'Food_Entities'[Publishedon] ),
        MAX ( 'Relation_Association'[PublishedOn] )
    )
)

vcgaomsft_0-1728614020029.png

Two-side relationships should be avoided in the model as much as possible, and if needed please turn them on in the code:

Count_contaminant = 
CALCULATE (
    COUNT ( 'Relation_Association'[food] ),
    CROSSFILTER ( 'Intermediate table'[Intermediate table], 'Food_Entities'[Food], BOTH )
)

vcgaomsft_1-1728614181159.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

HotChilli
Super User
Super User

I don't think that answers my first question. Both tables have Food in them and they both have dates but what do they have to do with each other?

HotChilli
Super User
Super User

In a business sense what does table Food Entities have to do with table Relation_Association?

Is it just the date which you want to filter on? In which case, can you remove the intermediate table, create a date dimension which links 1:n to both tables and use date from the date dimension in the filter?

Thank you for the reply, it is not just the date that I have to filter on. The Relation_Association table also has the food column, so the logic that we imply here is that "Visual Table 2:" is also also somehow filtered based on the food column.

For Example as a User I want to know what were the Contaminants associated with Apple during a period (publishedOn) column. So if I click on Apple in the Visual table 1, it should give me the contaminants associated with apple in Visual table 2: and if we filter the date again the Count in the Count_Contaminant column should change accordingly. 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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