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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
LiquidMetal
Frequent Visitor

Model View Compound Key Relationship

I have loaded two tables into Power BI Service.

 

I will need to join the two tables with two fields from each table.  So far, this seems like this is not possible.  Therefore, I have joined the two fields in the transact SQL and created a single field.  This works but is silly.  Anyway, in the model view, is there a way to do a compound key join?

 

I know that I can do a merge with DAX to do a compound join in power query.  Problem is it seems that it will take up space and impact performance.  I could be wrong.  Feel free to correct me on this assumption.

 

 

2 ACCEPTED SOLUTIONS
Ritaf1983
Super User
Super User

Hi @LiquidMetal 
There are a few methods to merge tables by multiple columns :
1. To concatenate columns an create a relationship by concatenated column (like you did on SQL)
2. Ro merge tables to one by multiple from PQ

Ritaf1983_0-1689428067528.png

3. Using TREATAS DAX Function.
For more details please refer to the linked video:
https://www.youtube.com/watch?v=WrwTCbKxG7U&t=860s
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

Hi @LiquidMetal 

1. Right.

2 Every solution has its perfomance costs...

You can check them with dax studio

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

5 REPLIES 5
LiquidMetal
Frequent Visitor

Rather than creating the join at the Model view in MS Power BI, would it be better to just join at the T-SQL level?

You are right again 🙂 

The rule is all processes that you can do on source , just do there .

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
LiquidMetal
Frequent Visitor

I have accepted your solution.  THanks

 

But just to confirm, so there is no way of creating compound joins in the Model View right?  It has to be through the above methods?  Also, method 2 will probably take up space and performance since it has to generate a new table.

Hi @LiquidMetal 

1. Right.

2 Every solution has its perfomance costs...

You can check them with dax studio

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
Ritaf1983
Super User
Super User

Hi @LiquidMetal 
There are a few methods to merge tables by multiple columns :
1. To concatenate columns an create a relationship by concatenated column (like you did on SQL)
2. Ro merge tables to one by multiple from PQ

Ritaf1983_0-1689428067528.png

3. Using TREATAS DAX Function.
For more details please refer to the linked video:
https://www.youtube.com/watch?v=WrwTCbKxG7U&t=860s
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors