Exercise 3
Exercise 3
Objective:
You work at AdventureWorks and your manager wants to see a report on
your latest sales figures. They've requested an executive summary of:
Which day had the most sales in February 2019?
Which country/region is the company seeing the most success in?
Which product category and reseller business types should the
company continue to invest in?
Get data the AdventureWorks Sales sample Excel workbook from the
O:drive
1. Open Power BI Desktop.
2. In the Data section of the Home ribbon, select Excel.
3. Navigate to where you saved the sample workbook, and
select Open.
4. Select all tables (except sheets labelled _data), and
choose Transform Data. Make sure not to select the sheets
(labeled _data).
5. Check that the data types of the columns match the data types in
the following table.
This model is a typical star schema that you might see from data
warehouses. The center of the star is a Fact table. The surrounding tables
are called Dimension tables, which are related to the Fact table with
relationships. The Fact table contains numerical information about sales
transactions, such as Sales Amount and Product Standard Cost. The
Dimensions provide context so you can, among other things, analyze:
What Product was sold...
to which Customer...
by which Reseller...
in which Sales Territory.
The little arrow in the middle of the line indicates the "cross-filtering
direction." It indicates that you can use values from the Date table to filter
the Sales table, so the relationship allows you to analyze when a Sales
order was placed.
The Sales table contains more information about dates related to Sales
orders, such as Due Date and Ship Date. Let’s add two more relationships
to the Date table by dragging:
DateKey to DueDateKey
DateKey to ShipDateKey
You notice that the first relationship, on OrderDateKey, is active, shown by
the continuous line. The other two are inactive, shown by the dashed
lines. Power BI uses the active relationship by default to relate Sales and
Date. Hence, a sum of SalesAmount is calculated by Order Date, not Due
Date or Ship Date. You can influence this behavior.
8. Create hierarchies
Create the following hierarchies.
1. Right-click the highest level, or the least granular, field in the
hierarchy and choose Create hierarchy.
2. In the Properties pane, set the Name of the hierarchy and set the
levels.
3. Then Apply Level Changes.
You can also rename levels in a hierarchy in the Properties pane after you
add them. You'll need to rename the Year and Quarter level of the Fiscal
hierarchy in the Date table.
9. Rename tables
Rename the following tables in the Properties pane:
As you can see, Sales Amount by Due Date trails slightly behind Sales
Amount. This proves that it uses the relationship between the Sales and
Date tables that uses DueDateKey.
4. Drag the matrix so it's wide enough to fill the space under the two
upper charts.
5. In the Format pane for the matrix, search for conditional. In the Cell
elements section, turn on Data bars. Select the fx option, and set
a lighter color for the positive bar. Select OK.
6. Increase the width of the Sales Amount column so it fills the whole
area by dragging the matrix.
It looks like Bikes have a higher Sales Amount overall and the Value
Added Resellers sell the most, closely followed by Warehouses. For
Components, the Warehouses sell more than the Value Added Resellers.
Now if your manager asks to see data only for a specific month, you can
use the slicer to switch between years or specific months in each year.