You are on page 1of 9

Assignment 3

Aim: Connecting to Data Source and Creating Data Models by


Establishing Relationships
Name: Sakshi Sonawani
GR. No.: 21810858
Roll No.: 431055
Branch: Information Technology.

Theory 
In Power BI, for different datasets of the same database, there may exist  a
lot of inconsistencies such as missing data, different nomenclatures  being
used, non-compatible mapping used, and hence for this, the  establishment of
relationships in this data is done. 
There are 4 types of relations: 
1. One to One: One element maps to only on element of the other table.
2. Many to One: Many elements of one table map to one element of the other
table.
3. One to Many: One element maps to various elements of the other table.
4. Many to Many: Multiple elements map to multiple other elements in the other
table. (Not usually preferred) 

Procedure & Screenshots:

1) Sample Tables:
Sales and Target dataset is used and relationship will be established in these two.
2) Opening Power Bi desktop.
3) Connecting to source data
4) Loading Data

5) After loading datasets in the Power Query, we create new query to create
the calendar table, which will act as the key to connecting the Sales and
Target sheet.
6) Advanced Editor option of the new query is selected to add a new table to
this query.

7) The below code creates the table by adding the dates from 1st January 2020
to 31st December 2020.
8) The Year, Month Name and Month Columns are created from the Date
Columns using add columns.

9) Establishing Relation and Data Key


 Removed columns and duplicates.
 The Data Key is creating by merging the date and month number.
 The DateKey in the calendar table.

 Month Numbers need to be assigned to the Month Names in the Sales and
Target sheets.
 Month numbers have to be assigned to the month names in the Sales and Target
Sheets

 The Sales and Targets sheets have been transformed according to our
requirement. Merged queries to get Datekey in sales and Target Table,
Removed unwanted Columns and Reordered Columns.
10) Result

You might also like