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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
John-Cena88
Frequent Visitor

Bridge Table for two fact tables which get „filtered“ by dimension table.

Hello,

 

I am stuck with a problem regarding my data model and hope someone can help me with that. 

I got two fact tables which have several dimension each that "filter" these fact tables. Fact table a contains transaction details with a specific id and an amount. Fact table b also. I want to display a table visual in my report which basically lists the id and the sum of the amount for that id. Problem is, that fact table a and b don't contain the same ids. So I created a bridge table and linked that to the fact tables. 

For my table visual I use the id in the bridge table to display the sum of the amount for each id. Problem here is that I see ids which should not be in this visual because of the dimension tables which "filters" each of the fact tables. 


Any idea how to solve that problem?

2 ACCEPTED SOLUTIONS
Sahir_Maharaj
Super User
Super User

Hello @John-Cena88,

 

Instead of relying on the automatic filtering through relationships, consider creating DAX measures that explicitly calculate the sums for each ID:

Sum Amounts with Filter = 
CALCULATE(
    SUM(FactTableA[Amount]),
    FILTER(
        BridgeTable,
        BridgeTable[ID] IN VALUES(FactTableA[ID]) && <DimensionTableFilterConditionA>
    )
)
+ CALCULATE(
    SUM(FactTableB[Amount]),
    FILTER(
        BridgeTable,
        BridgeTable[ID] IN VALUES(FactTableB[ID]) && <DimensionTableFilterConditionB>
    )
)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

View solution in original post

Anytime - Happy to help! 

 

The star schema is effective for many scenarios, but there are situations where it might not handle complex filtering or aggregation "out of the box," particularly when:

  • Dealing with complex many-to-many relationships.
  • Requiring custom calculations that span across multiple tables.
  • Needing to enforce specific filter contexts that aren't naturally supported by the existing relationships.

Understanding when and how to extend your data model with DAX is key.

 

Dont hesitate to let me know if you might have any further questions!


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

View solution in original post

4 REPLIES 4
Sahir_Maharaj
Super User
Super User

Hello @John-Cena88,

 

Instead of relying on the automatic filtering through relationships, consider creating DAX measures that explicitly calculate the sums for each ID:

Sum Amounts with Filter = 
CALCULATE(
    SUM(FactTableA[Amount]),
    FILTER(
        BridgeTable,
        BridgeTable[ID] IN VALUES(FactTableA[ID]) && <DimensionTableFilterConditionA>
    )
)
+ CALCULATE(
    SUM(FactTableB[Amount]),
    FILTER(
        BridgeTable,
        BridgeTable[ID] IN VALUES(FactTableB[ID]) && <DimensionTableFilterConditionB>
    )
)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

What would we do if we didn't have legends like you! That worked as excepted. Could you explain to me why the relationship didn't do the job in such a case? What's even the deal to do the starschema if it doesn't work properly. 

Anytime - Happy to help! 

 

The star schema is effective for many scenarios, but there are situations where it might not handle complex filtering or aggregation "out of the box," particularly when:

  • Dealing with complex many-to-many relationships.
  • Requiring custom calculations that span across multiple tables.
  • Needing to enforce specific filter contexts that aren't naturally supported by the existing relationships.

Understanding when and how to extend your data model with DAX is key.

 

Dont hesitate to let me know if you might have any further questions!


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Hi Sahir, I have a follow-up question regarding my problem. The calculation you provided works fine and leads to the expected outcome (as mentioned earlier). The problem I have now. 

Based on the calculation we did and the output of that, I have to create another measure which assigns a source a or b. For example if the value of our calculation is 1 then a else b. But when I do that the whole filter context is broken and instead of 7k rows (which is the expected number based on the filter in the calculation measure) we have 24k (every id in the bridge table) any idea how to solve that? 

I could build this whole table in power query with merging etc which I did and it works fine but I wanted to set it up as a star schema ...

 

any idea?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors