When you import two or more tables in Power BI, Relationship between those tables creates a very important roles in order to display correct calculation values & information in Power BI reports.
Power BI is very smart tool, based on same column name Power BI autodetect feature attempts to find and create relationships for you and sometimes you might have to create relationships manually.
Also, you can create, edit or remove the relationships to using Manage relationships under Modeling tab.
Consider following two tables-
Now let’s assume, you want to see Total price for products against each OrderId, so for this you need price of each products, then you can multiply each product Qty with their price to get the Total Price.
You can get the Product price from Price table but it is not possible without relationship between both tables. And this is the reason why relationships are necessary between tables.
Create a relationship with autodetect
Power BI autodetect feature attempts to find and create relationships for you, if you noticed above mentioned both tables Product column name are same.
So, autodetect feature will automatically create a relationship between both tables based on Product column. You can see the same in below screen shot-
Now right click to yellow highlighted relationship line and click on Delete, after that click on Manage relationships.
You can see in above screen shot relationships between both tables has been deleted, now click on Autodetect button.
After that one dialog box appears with success message, closed this box and in second screen you can see the the relationship between both tables.
Edit a relationship
You can Edit the Relationship in many ways-
Way-1: Go to Modeling tab in Power BI header menu > select Manage Relationships > In the Manage relationships dialog box, select the relationship, then select Edit.
Way-2: Inside Model view double click on Relationship line >Edit relationships dialog box appears.
Way-3: Inside Model view > Click on Home tab, select Manage Relationships > In the Manage relationships dialog box, select the relationship, then select Edit.
Create a Relationship Manually in Power BI-
Way-1: Inside Model view > Click on Home tab, select Manage Relationships > In the Manage relationships dialog box, select New.
After that create relationship dialog box appears, select both tables in each dropdown and select Product column from both tables then click on OK button.
Way-2: Go to Modeling tab in Power BI header menu > select Manage Relationships > In the Manage relationships dialog box, then select New.
Delete Relationship in Power BI-
-Under Model view, right click on Relationship line and select Delete.
-Delete through Mange Relationships dialog box.
Hope you enjoyed the post. Your valuable feedback, question, or comments about this post are always welcome or you can leave us message on our contact form , we will revert to you asap.