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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
raeldor
Advocate I
Advocate I

Create Relationship on Compound Key

So, can someone tell me why I can't join tables on more than one key?  This seems like one of the most basic query functions yet it can't be done.  I see people saying 'create a calculated column', but how is that efficient?  Now the whole think becomes text and I likely need to pad the ID fields too to avoid incorrect keys.

8 REPLIES 8
Anonymous
Not applicable

You can do it in M. If you choose in your transformation in Home/ "Merge Queries", you can highlight the 2 columns to match in both sides of the join.

 

Anonymous
Not applicable

@Anonymous what next? I merged the tables using 3 columns "Merge Queries" and "Merge Queries as New". With the first option it appears as a new column labled "Table", but I can't figure out how to add this data to the dashboard. When using "Merge Queries as New", a new table is created, but a) It doesn't have all columns, and b) the tables don't seem to be linked.

My expectation is that when I select a row in the "Parent" table visual, the "Child table" is filtered with just those rows.

Ex: 

Parent
A-1-x
A-1-y
A-1-z

Child
A-1-x-1

A-1-x-2
A-1-y-1

A-1-y-2
A-1-z-1

A-1-z-2

When I select a row in "Parent", "Child" only shows two rows.

Anonymous
Not applicable

Hi sorry only seeing this now - just expand the column (seems your are only clicking the record) and you should see everything (check the type of join too, by default left outer join)

v-xjiin-msft
Solution Sage
Solution Sage

@raeldor

 

In current Power BI, there exists a limitation for relationship that you can’t create relationship based on more than one column. 

 

To workaround this limitation, we can concatenate these related columns into one calculated column, then create relationship based on this concatenate column. Please refer:

 

1.PNG

 

2.PNG

 

Reference: Relationship in Power BI with Multiple Columns 

 

Thanks,
Xi Jin.

So, I know HOW to do it.  The question is really... why do I need to?

@raeldor

 

This is the limitation for relationship in current Power BI and it is by design. Smiley Sad

 

Thanks,
Xi Jin.

A little odd considering every relational database I've ever seen allows multi-field joins.  Seems a little unfair making users jump through hoops to do something so common. 😞

I agree. it's crazy that 6 years after this original post you still can't create a table relationship on multiple keys 😂

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 MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.