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

Bridge Table? Surrogate Key? to fix a many-to-one one-to-many

I will paste my current data model below. I've got my Sales fact table that relates to my Customer dimensional table through the CustomerKey field in a many-to-one relationship. Some customers have several emails so I have to create another table named Email to keep the Customer table one row per customer. Then the relationship between Customer and Email tables is one-to-many. Now I can't filter the Sales table by Email without doing a bidirectional filter. What's the best practice for these type of situations? Bridge table? Surrogate key? I can't figure out how to do this the "best way". I can't find any YouTube videos that go over this type of situtation which occurs in almost all of my data sets.

 

dm.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

Thanks for the solutions miTutorials  and girishthimmaiah  offered, and i want to offer some more information for user to refer to.

hello @calcstuff , you can use crossfilter() function, it can change the filter direction by using dax without change the model,  you can refer to the following sample measure.

Sample =
CALCULATE (
    SUM ( 'Sales'[Sales Amount] ),
    CROSSFILTER ( 'Customer'[CustomerKey], 'Email'[CustomerKey], BOTH )
)

And you can refer to the following link to know more about the function.

CROSSFILTER function - DAX | Microsoft Learn

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi,

Thanks for the solutions miTutorials  and girishthimmaiah  offered, and i want to offer some more information for user to refer to.

hello @calcstuff , you can use crossfilter() function, it can change the filter direction by using dax without change the model,  you can refer to the following sample measure.

Sample =
CALCULATE (
    SUM ( 'Sales'[Sales Amount] ),
    CROSSFILTER ( 'Customer'[CustomerKey], 'Email'[CustomerKey], BOTH )
)

And you can refer to the following link to know more about the function.

CROSSFILTER function - DAX | Microsoft Learn

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

miTutorials
Super User
Super User

girishthimmaiah
Resolver I
Resolver I

 

A bridge table should be created with CustomerKey and Email. The Sales table is linked to the Customer table (many-to-one), while the Email table is linked to the bridge table (many-to-one). Then use DAX to apply filters from the Email table to the Sales table.

Total Sales by Email =
CALCULATE(
[Total Sales],
FILTER(
CustomerEmailBridge,
CustomerEmailBridge[Email] IN VALUES(Email[Email])
)
)

 

Isn't that what I already have? What you refer to as the bridge table is my current table named Email. This Email table isn't able to filter Sales. That's my whole problem and I think it's because my data model is wrong.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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