Power BI is quite an interesting data tool and one of the concepts that I have enjoyed working on is relationships. This simply refers to the connection made between two tables.
It is created by joining two separate tables using a selected column that has similar information on both tables. The table selected first is the fact table and the other table is the dimension table. There is a primary key in one table which is the unique identifier that maps on to the foreign key in the other table.
There are four types of relationships:
i)One to One
This is the simplest type of relationship. Values from the selected column of the first table match perfectly with values from the second table. All the values appear only once in each table hence a one-to-one relationship.
Consider two tables; one with sales date and another with calendar dates. The sales date can only match with one date on the calendar table, this creates a connection between the two tables based on these columns.
ii)One to Many
For this type of relationship, values in the first table match multiple values on the second table.
When you have customer table with customer id and sales table with customer id, the customer ID can match the sales table multiple times. This is because one customer can have multiple sales creating a one-to-many relationship.
iii)Many to One
This is basically a reverse of the on- to-many relationship; multiple values from the first table match one value on the second table.
For example, table with Sales information and another table with Products information. The common column between them is the product ID column. In this case, there are multiple sales that are made of one product. Therefore, multiple values on the sales table match with one value on the product table.
iv)Many to Many
In this type of relationship, multiple values from the first table match with multiple values from the second table.
Another thing about relationships is the cross-filter direction. This refers to the direction in which a filter that is applied on tables that have a relationship affect those tables.
a) Single cross filter direction - filters are applied from one table to another
b)Both cross filter direction - filters are applied in both tables
Relationships in PowerBI have made it easy to understand, explore and join tables for easier visualization of data and I can't wait to learn more!
Top comments (0)