2_Design_and_develop_the_data_model
2_Design_and_develop_the_data_model
model
Introduction
As you’ve worked with Power BI, you've seen first-hand how data can tell stories to inform
insights. In this exercise, you’ll put this knowledge into practice by working with sales data
from around the globe to prepare a report.
Case study
Tailwind Traders needs a report that shows the company’s worldwide sales and profits.
However, the sales and profit data must be displayed in US dollars. Let’s help Tailwind
Traders create this report so that it can generate insights into its global sales.
Instructions
Open the Tailwind Traders Report.pbix Power BI file you have created in the previous
exercise. Access Model View in Power BI to view the report's tables. Your Power BI
environment should resemble the screenshot below. Follow the prompts to design and
develop a data model from these tables.
Step 1: Create a relationship between the Countries and Exchange Data tables
1. Create a relationship between the Countries and Exchange Data tables on the Exchange
ID field.
5. Inspect the relationship arrow in the Model View to ensure the arrows point in both
directions and display a 1:1 symbol on either end of the connector.
1. Create a relationship on the Country ID field between the Sales and Countries tables.
5. Inspect the relationship arrow in the Model View to ensure the arrows point in both
directions and display a *:1 symbol on either end of the connector.
1. Create a relationship on the OrderID field between the Purchases and Sales tables.
2. Set the Cardinality to One to One (1:1).
5. Inspect the relationship arrow in the Model View to ensure the arrows point in both
directions and display a 1:1 symbol on either end of the connector.
• Select New Table and add the following DAX code to create a new Calendar table:
CalendarTable =
ADDCOLUMNS(
"Year", YEAR([Date]),
"Quarter", QUARTER([Date]),
"Weekday", WEEKDAY([Date]),
"Day", DAY([Date])
1. Create a relationship on the Date field between the Calendar and on Purchase Date in the
Purchases table.
4. Inspect the relationship arrow in the Model View to ensure the arrows point in both
directions and display a *:1 symbol on either end of the connector.
Sales in USD =
ADDCOLUMNS(
Sales,
"Country Name", RELATED(Countries[Country]),
"Exchange Rate", RELATED('Exchange Data'[ExchangeRate]),
"Exchange Currency", RELATED('Exchange Data'[Exchange Currency]),
"Gross Revenue USD", [Gross Revenue] * RELATED('Exchange
Data'[ExchangeRate]),
"Net Revenue USD", [Net Revenue] * RELATED('Exchange
Data'[ExchangeRate]),
"Total Tax USD", [Total Tax] * RELATED('Exchange Data'[ExchangeRate])
)
2. Note the Gross Revenue USD, Net Revenue USD, and Total Tax USD for the Order
ID= 1035 on the Sales in USD table.
Step 7: Create a relationship between the Sales in USD and Sales tables
1. Create a relationship between the Sales in USD and Sales tables on the Order ID field.
4. Inspect the relationship arrow in the Model View to ensure the arrows point in both
directions and display a 1:1 symbol on either end of the connector.
Conclusion
Having completed the assigned tasks, you have demonstrated the skills to design and develop
a data model!