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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
GiangLe
Helper I
Helper I

composite primary key

Hi everyone, 

 

I'm quite new to Power BI and it's everyday story that i stumble upon something new which is good.

My today question is about data modelling. In many to many relationships, it is a must to create a key to connect 2 tables. today i come accross the concept of composite primary which is a key made up from many collumn. However, i'm struggle to understand in which case i need create this composite primary key?

and how many methods i can do this? i've seen people do with with concatenate syntax

thanks a lots

 

1 ACCEPTED SOLUTION
GeorgeBuster
Advocate III
Advocate III

Hi GiangLe,

 

As you know, in Power BI you need a single column to link two tables (you can't define a key with two columns as you can in common databases). This column has necessarily to have unique values on one side of the relationship because Power BI doesn't work directly with a "many to many" relationship. In conclusion,  you will need to create a key using two columns with CONCATENATE or create a table with unique values between tables with non-unique values.

Example: You have two fact tables with the sales of your employees and other with the wages of them, both have two columns with the name and surname of the employees. Firstly, you can define a primary key concatenate their name and surname and secondly, you need two create a table between them with the unique values of each employee. In that way, you will have a many (sales table) to one (employee table) relationship and a one (employee table) to many (wages table) relationship and PowerBI will work perfectly.

View solution in original post

2 REPLIES 2
GeorgeBuster
Advocate III
Advocate III

Hi GiangLe,

 

As you know, in Power BI you need a single column to link two tables (you can't define a key with two columns as you can in common databases). This column has necessarily to have unique values on one side of the relationship because Power BI doesn't work directly with a "many to many" relationship. In conclusion,  you will need to create a key using two columns with CONCATENATE or create a table with unique values between tables with non-unique values.

Example: You have two fact tables with the sales of your employees and other with the wages of them, both have two columns with the name and surname of the employees. Firstly, you can define a primary key concatenate their name and surname and secondly, you need two create a table between them with the unique values of each employee. In that way, you will have a many (sales table) to one (employee table) relationship and a one (employee table) to many (wages table) relationship and PowerBI will work perfectly.

GiangLe
Helper I
Helper I

help pls 😛

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.