Data Modeling In Power BI

Introduction

 
Data model is a powerful feature of Power BI. Data Modeling is used to connect multiple data sources using a relationship. A relationship shows how these data sources are connected together. Through data modeling, you can create an interesting visualization and reports.
 
To start data modeling, we will first create a relationship. We can also create a calculated column, create a required visualization of data and much more.
 
Let’s start this article. Below are the steps to create a relationship between two tables.
 
Step 1
 
Here we have two csv files for Employee and Department. So first I am going to import data from these two sources into the Power BI by clicking on ‘Get data’ and select ‘Text/CSV’ from the ‘Home’ tab.
 
Data Modeling In Power BI
 
Data Modeling In Power BI
 
Step 2
 
At the right side of the BI tool there are three symbols for ‘Report’, ‘Data’ and ‘Model’. While you click Report you can see the visual of the table in multiple visualization chart. By clicking on ‘Data’ symbol you can check the data of the selected table.
 
Data Modeling In Power BI
 
Third symbol is ‘Model’, here you can create a relationship between the tables. While you click on ‘Model’ you can see all existing tables.
 
Data Modeling In Power BI
 
Step 3
 
Here we will create a relationship between these two tables i.e. ‘Employee’ and ‘Department’. We have two ways to do this.
  1. Just drag the common column from one table to another. In our case the DPT_ID is the common column through which we can join our table. Now drag the ‘DPT_ID’ from employee table to ‘Department’. A new window ‘Create Relationship’ will be opened. Now click on ‘Ok’.

    Data Modeling In Power BI

    Data Modeling In Power BI
  1. The second way is to right click on ‘Employee’ table and click on ‘Manage Relationship’.

    Data Modeling In Power BI

    Data Modeling In Power BI
Here we have two options ‘New’ and ‘Autodetect’. If you click on ‘Autodetect’, It will automatically connect two tables through the common column.
 
Data Modeling In Power BI
 
Data Modeling In Power BI
 
Click on ‘Close’ and you can see the relationship has been made.
 
Data Modeling In Power BI
 
Also, if you click on ‘New’ then the  ‘Create Relationship’ window will be opened.
 
Data Modeling In Power BI
 
Now select the table that you want to join and click on ok.
 
Data Modeling In Power BI
 
Data Modeling In Power BI 
 
You can delete the relationship by right clicking on the middle yellow line and click on delete.
 
Data Modeling In Power BI
 
You can also hide the particular column from the visualization by right clicking on the column and selecting ‘Hide in report view’ option.
 
Data Modeling In Power BI
 

Summary

 
In this article you have learned how to make a relationship between two tables. This is the first step of Data modeling. To learn more about data modeling, stay with us.
 
Thanks for reading. Have a nice day.