The Data Model: Relationships Between Tables
When data lives in two tables, a relationship links them — so a sale knows which customer it belongs to.
What you will learn
- Understand why data is split into tables
- See a relationship on the Model view
- Match a key column in both tables
Why more than one table?
Good data is usually split into separate tables to avoid repeating yourself. Instead of typing a customer name on every single sale, you keep customers in one table and sales in another, and link them. This is called a data model.
Picture two tables:
- A Sales table: each row is one sale, with a
CustomerID, a product and an amount. - A Customers table: each row is one customer, with a
CustomerID, a name and a city.
The shared key column
Both tables share a column: CustomerID. That shared column is the key that lets Power BI connect them. A relationship says: “the CustomerID in Sales matches the CustomerID in Customers.”
| Sales table | links by | Customers table |
|---|---|---|
| CustomerID = 7 | → | CustomerID = 7 → “Asha, Delhi” |
| CustomerID = 7 | → | (same customer) |
| CustomerID = 12 | → | CustomerID = 12 → “Ravi, Pune” |
Creating the relationship
On the far-left of Power BI Desktop there are three small icons: Report, Data, and Model. Click the Model view (it looks like little connected boxes). You will see each table as a box listing its columns. To link them:
- Find
CustomerIDin the Sales box. - Drag it onto
CustomerIDin the Customers box. - A line appears between the two tables — that line is the relationship.
Power BI is smart: when it spots two columns with the same name, it often creates this line for you automatically.
Customers (1) ────────< (many) Sales
One customer -> can have many sales
Many sales -> each belong to one customerNote: Output: The little 1 sits next to Customers and the * (many) sits next to Sales, showing one customer can appear in many sales rows. Now a chart can show “total Amount by customer City”, even though City lives in one table and Amount lives in the other — the relationship carries the link across.
Tip: This one-to-many shape is by far the most common: one customer → many sales, one product → many orders. The “one” side is the lookup list; the “many” side is the table of events.
Watch out: A relationship needs matching values in both key columns. If Sales has CustomerID 99 but Customers has no row for 99, those sales will not match a customer and may show as blank in your visuals.
Q. What lets Power BI connect a Sales table to a Customers table?
✍️ Practice
- Open Model view and identify the shared key column between two of your tables.
- Drag one key column onto the matching column in the other table to create a relationship.
🏠 Homework
- With a Sales table and a Customers table, create a one-to-many relationship on CustomerID and describe which side is the “one” and which is the “many”.