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
farooqk_aziz
Advocate I
Advocate I

Power BI Auto Detect Relationship Failure

In this article, we will talk about how to manually create a relationship by identifying the primary and foreign keys if Power BI is unable to identify the correct auto-relationship between the tables after we import a dataset Sample Sales Data.

Preparing the Dataset

In the first step, I will connect with an Excel workbook by clicking on Get Data. To learn more about the data connector in Power BI, please click on this link: Data sources in Power BI Desktop.

image.png

Once I click on the Excel workbook, the new window will open. I will click on sales sample data from my local computer and click open. Here is the sample data Sales Sample Data.

 

image.png

 

In the next step, Power BI navigator will open. Since I required all the four tables Customer, Product, Region and Sales, I will check mark all of them. On the bottom right click to load inside Power BI.

image.png

Once you imported the Sales Sample Data , the Power BI will auto detect the relationships between the tables . Once we click on model view, so it will look like below screenshot.

image.png

Note: If you noticed there is relationship between sales table to customer table but not region and product table. Since Sales is our master or main table,  it needs to have relationship between all the four tables. We need to analyze our data to established a relationship.

 

Analyzing missing relationship tables

In order to analyze the product table, we need to click on table view as per the image below. You will notice that the product table has an Index column with unique codes that can be our Primary key. Similarly, we will see the same in region table as well. You can learn more about primary and foreign key concepts here: Difference between Primary Key and Foreign Key.

image.png

After analyzing product and region table and identifying their primary key, we have to see if similar keys are present in sales table. We can see both the index columns as primary keys from the product and region tables present in the sales table as the delivery_region_index column and the product_description_index column as foreign keys. You can see these links in the image below.

image.png

Once we identified the columns need to create relationships, we will click on manage relationships and create 1-many relationships from the sales table(many) to all other 3 tables. Those tables are the customer, product, and region tables.

 

Finally, our data model should look like as per the screenshot below. For detail understanding of Power BI relationships Create and manage relationships in Power BI Desktop and Model relationships in Power BI Desktop.

 

image.png

The auto-detect relationship is unable to identify essential joins between tables; therefore, specific procedures must be followed for diagnosis.

  • We found the unique column in product and region table which is also the primary key.
  • We identified the same two columns in sales table as a foreign key.
  • Once we identified primary key and foreign key we have joined the sales table with region and product table with 1 - to - many relationship.
3 REPLIES 3
lbendlin
Super User
Super User

Have you considered putting this up as a blog entry?

No, I haven't, but I would love to. How can I do that ? 

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.