Lab 2 - Data Modeling and Exploration
Lab 2 - Data Modeling and Exploration
Lab 2 - Data Modeling and Exploration
• You must download the Power BI Content: Create a folder called DIAD on the C drive of your local
computer. Copy all contents from the folder called Dashboard in a Day Assets to the DIAD folder
you just created (C:\DIAD).
• You must download and install Power BI Desktop using any one of the options listed below:
Document Structure
This is lab two out of five labs in total. Please continue to use your file after completing Lab 1, if you are
joining the DIAD at this point or were unable to complete Lab 1, please start this lab with the “Lab 1
solution.pbix” file you can find in the Reports folder.
The lab includes steps for the user to follow along with associated screenshots that provide a visual aid. In
the screenshots, sections are highlighted with red or orange boxes to indicate the area the user needs to
focus on.
Note: This lab uses real, anonymized data provided by ObviEnce, LLC. Visit their site to learn about their
services: www.obvience.com. This data is the property of ObviEnce, LLC and has been shared to
demonstrate Power BI functionality with industry sample data. Any use of this data must include this
attribution to ObviEnce, LLC.
1. On the top of the window, you see the Home tab where the most common operations you perform are
available.
2. The Insert tab in the ribbon allows you to insert shapes, a text box or new visuals
3. The Modeling tab in the ribbon enables additional data modelling capabilities like adding custom
columns and calculating measures.
4. The View tab has options to format the page layout.
5. The Help tab provides self-help options like guided learning, training videos and links to online
communities, partner showcase and consulting services.
6. On the left side of the window, you have three icons, Report, Data and Model. If you hover over the
icons, you can see the tooltips. Switching between these allows you to see the data and the relationships
between the tables.
8. The Visualizations panel on the right allows you to select visualizations, add values to the visuals, and
add columns to the axis or filters.
9. The Fields window on the right panel is where you see the list of tables which were generated from the
queries. Click the icon (downward facing triangle) next to a table name to expand the field list for
that table.
11. Click on the Model icon on the left panel of Power BI Desktop. You see the tables you have imported
along with Relationships. The Power BI Desktop automatically infers relationships between the tables.
• A relationship is created between the Sales and Product tables using the ProductID column.
• A relationship is created between the Product and Manufacturer tables using the ManufacturerID
column.
Power BI supports multiple types of relationships:
• 1 to many
• 1 to 1
• Many to many
In this lab, we will be using the 1 to many type of relationship, the most common type of relationship. This
means one of the tables involved in the relationship should have a unique set of values. We will create
additional relationships later in this lab.
Note: Tables may not appear as shown in the figure. You can zoom in and out of the Relationships page by
dragging the zoom slider in the bottom right corner of the window. Also, if you want to ensure you are
Notice that the revenue of each country is the same. Now we need to create a relationship between the
Sales and Geography tables.
You will notice the Create relationship dialog opens with a warning message at the bottom stating the
relationship has a many-many cardinality. The reason for the warning is that we don’t have unique Zip
values in the Geography table. This is because multiple countries could have the same Zip code. Let’s
concatenate the Zip and Country columns to create a unique value field.
18. Click Cancel in the Create relationship dialog box.
We need to create a new column in both the Geography table and the Sales table that combines the Zip
and Country columns. Let’s start by creating a new column in the Sales table.
19. Click on the Report icon on the left panel to navigate to the Report view.
20. In the Fields section, click on the ellipse next to the Sales table. Click the New Column as shown in the
figure. You will see a formula bar appear, as shown in the screenshot, to help create this new column.
Let us use this method to create a ZipCountry column in the Geography table.
23. From the Fields section, click the Geography table, from the ribbon click Modeling, and then click New
Column as shown in the figure.
24. A formula bar now appears. Enter the following DAX expression in the formula bar:
ZipCountry = Geography[Zip] & "," & Geography[Country]
Now we have successfully created a relationship. The number “1” next to Geography indicates it is on the
one side of the relationship and the “*” next to Sales indicates it is on the many side of the relationship.
27. Click on the Report icon on the left panel to navigate to the Report view.
29. From the Fields section, expand the Manufacturer table, and then drag the Manufacturer column to
the Legend section under Visualizations.
30. While you have your chart selected, click the Clustered column chart from the Visualizations section,
and then click the Stacked column chart visual.
31. Resize the visual as needed.
We are interested in the top five competitors by revenue. Let’s group them so we don’t have to add a
filter to every visual. Before we do that, we’ll remove the Top 5 visual level filter.
41. Begin with Clustered column chart selected.
42. Hover over and click the Clear filter icon (erase) next to Manufacturer field in the Filters Pane.
43. From the Fields section, right-click on the Manufacturer field name from Manufacturer table. Note:
do not check the checkbox.
44. Click New Group.
45. In the Ungrouped values section, using Ctrl key, click Aliqui, Currus, Natura, and Pirum.
46. Click the Group button. Notice a new group is added in the Groups and members section.
47. Double-click the newly created group and rename it Top Competitors.
48. Click VanArsdel from the Ungrouped values section and click the Group button to create the
VanArsdel group.
49. Click the checkbox Include Other group. This will create another Other group that includes all the
other manufacturers.
50. Click OK to close the Groups dialog.
Notice now in both Revenue by Year and Revenue by Manufacturer, data is filtered for Australia
70. Now click the Revenue by Year visual.
71. Next, click the filter icon on the other two visuals.
We have already noticed that VanArsdel has a large share of the market in Australia. Let’s see how
VanArsdel has done over time in Australia.
75. Click on the Revenue by Country and Manufacturer (groups) chart and remove Manufacturer
(groups) from the legend.
76. Click on VanArsdel in the Revenue by Manufacturer visual.
77. Ctrl+Click the Australia column in the Revenue by Country visual.
Now we have filtered the charts by both VanArsdel and Australia. Looking at the results, we can see a
spike in 2020 sales for VanArsdel in Australia. This spike in sales is intriguing, so let’s investigate further.
78. Click the down arrow on the top of the Revenue by Year visual. This enables drill-down capability.
81. Click on the up-arrow icon on the top of the Revenue by Year visual to drill up to the Quarter level.
82. Click on the drill up icon again to go up to the Year level
83. Click on the split arrow icon on the top right of the Revenue by Year visual. This expands down to the
next level of the hierarchy, which is quarters for all the years.
Notice that the fourth-quarter sales have always been high, but in 2020 there was a larger sales spike in
the fourth quarter than usual.
There is a lot of information in the visual and we must scroll left and right to compare.
Now that we’ve explored the data, let’s add a slicer so we can filter by the manufacturers.
85. Click on the white space in the canvas. From the Fields section, click the checkbox next to the
Manufacturer field in the Manufacturer table.
86. From the Visualizations section, click on the Slicer visual.
87. Here you will see a list of Manufacturers. Click VanArsdel and notice that all the visuals are filtered
based on your selection.
88. Hover over the top right corner of the visual and click on the down arrow. Notice you have the option
to change the slicer from a list to a dropdown.
89. Click Dropdown.
90. Click VanArsdel from the dropdown.
The card visual gives us the Revenue as we filter and cross-filter the visuals.
Notice that all key dimensions are in their table with related attributes, except the date. For example,
Product attributes are in the Product table. Now let’s create a Date table.
We are using two DAX functions: the CALENDAR function, which takes the start and end data, and the
DATE function, which takes the year, month, and date Fields.
For this lab, we will create Dates from 2012 to 2020, since we have data for those years. We can also add
more Fields, like Year, Month, Week, etc., to this table by using DAX functions.
Notice that the Date field is of the type Date/Time. Let’s change it to the Date data type.
98. Click on the Date field in the Date table.
99. From the ribbon, click Column Tools, click Data type, and then click Date.
Next, we need to create a relationship between the newly created Date table and the Sales table.
100. From the ribbon, click Column Tools, and then click Manage Relationships.
101. A Manage Relationships dialog box opens. Click the New button.
Notice that the new Date field behavior is like it was previously.
Since there are now two Date Fields, it may be confusing to know which one to use. To accommodate this,
let’s hide the Date field in the Sales table.
112. From the Fields section, click on the ellipse next to the Date field in the Sales table.
113. Click Hide to hide the Date field in the reports view. We have the option to view hidden fields and
unhide fields as needed.
Notice that a new field called Category Hierarchy is created in the Product table.
143. Do the same thing with the Revenue by Year visual, change the interaction of the Revenue by
Category to filter
144. We also need to change the interactions of the other charts. Click on the Revenue by Category visual
and change the Revenue by Year visual to a filter action.
145. Click the filter interaction on the Revenue by Country visual as well
146. Click the format tab and click Edit interactions to turn it off
147. Let’s get back to the Revenue by Category visual
Let’s add a percent of the total field. This will give us a better perspective.
164. Navigate away from the Format section to the Fields pane.
165. From the Fields section, drag the Revenue field from the Sales table to below the existing Revenue
field in the Values section. It will look like you have Revenue twice in the fields pane
170. Make sure you have Australia and 2020 selected on the other charts.
Now let’s look at the Extreme category for Australia over time.
182. Click the checkmark next to the formula bar. You will see the PY Sales measure in the Sales table.
Let’s create another measure.
183. In the Fields section, hover over the Sales table.
184. Click on the ellipse in the right corner.
185. Click New Measure from the dialog box. A formula bar opens.
186. Enter % Growth = DIVIDE(SUM(Sales[Revenue])-[PY Sales],[PY Sales])
192. Similarly, from the Fields section, and then click the PY Sales field.
193. From the ribbon, click Measure Tools, click Format, and then click Currency, if it isn’t already
formatted Currency .
194. Similarly, from the Fields section, and then click the Revenue field.
195. From the ribbon, click Measure Tools, click Format, and then click Currency if it isn’t already
formatted to Currency
Here are a few more resources that will help you with your next steps with Power BI.
• Getting started: http://powerbi.com
• Power BI Desktop: https://powerbi.microsoft.com/desktop
• Power BI Mobile: https://powerbi.microsoft.com/mobile
• Community site https://community.powerbi.com/
• Power BI Getting started support page:
https://support.powerbi.com/knowledgebase/articles/430814-get-started-with-power-bi
• Support site https://support.powerbi.com/
• Feature requests https://ideas.powerbi.com/forums/265200-power-bi-ideas
• New ideas for using Power BI https://aka.ms/PBI_Comm_Ideas
• Power BI Courses http://aka.ms/pbi-create-reports
© 2020 Microsoft Corporation. All rights reserved.
By using this demo/lab, you agree to the following terms:
The technology/functionality described in this demo/lab is provided by Microsoft Corporation for purposes of
obtaining your feedback and to provide you with a learning experience. You may only use the demo/lab to evaluate
such technology features and functionality and provide feedback to Microsoft. You may not use it for any other
purpose. You may not modify, copy, distribute, transmit, display, perform, reproduce, publish, license, create
derivative works from, transfer, or sell this demo/lab or any portion thereof.
COPYING OR REPRODUCTION OF THE DEMO/LAB (OR ANY PORTION OF IT) TO ANY OTHER SERVER OR LOCATION
FOR FURTHER REPRODUCTION OR REDISTRIBUTION IS EXPRESSLY PROHIBITED.
MICROSOFT CORPORATION HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS WITH REGARD TO THE
DEMO/LAB, INCLUDING ALL WARRANTIES AND CONDITIONS OF MERCHANTABILITY, WHETHER EXPRESS, IMPLIED OR
STATUTORY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. MICROSOFT DOES NOT MAKE
ANY ASSURANCES OR REPRESENTATIONS WITH REGARD TO THE ACCURACY OF THE RESULTS, OUTPUT THAT DERIVES
FROM USE OF DEMO/ LAB, OR SUITABILITY OF THE INFORMATION CONTAINED IN THE DEMO/LAB FOR ANY
PURPOSE.
DISCLAIMER
This demo/lab contains only a portion of new features and enhancements in Microsoft Power BI. Some of the
features might change in future releases of the product. In this demo/lab, you will learn about some, but not all, new
features.