0% found this document useful (0 votes)
51 views11 pages

Exercise 3

Uploaded by

manavlakhani18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views11 pages

Exercise 3

Uploaded by

manavlakhani18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

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?

Create a final report that should look like:

 Prepare your data with a few transformations


 Build a report with a title, three visuals, and a slicer
 Publish your report to the Power BI service so you can share it with
your colleagues

The Adventure Works has seven tables:


Table Description
Custome Describes customers and their geographic location.
r Customers purchase products online (Internet sales).
Date There are three relationships between
the Date and Sales tables, for order date, ship date, and due
date. The order date relationship is active. The company's
reports sales using a fiscal year that commences on July 1
of each year. The table is marked as a date table using
the Date column.
Product Stores finished products only.
Reseller Describes resellers and their geographic location. Reseller
on sell products to their customers.
Sales Stores rows at sales order line grain. All financial values are
Table Description
in US dollars (USD). The earliest order date is July 1, 2017,
and the latest order date is June 15, 2020.
Sales Describes sales order and order line numbers, and also the
Order sales channel, which is either Reseller or Internet. This table
has a one-to-one relationship with the Sales table.
Sales Sales territories are organized into groups (North America,
Territory Europe, and Pacific), countries, and regions. Only the United
States sells products at the region level.

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.

Table Column Data type


Customer CustomerKey Whole Number
Date DateKey Whole Number
Date Date
MonthKey Whole Number
Product ProductKey Whole Number
Standard Cost Decimal Number
List Price Decimal Number
Reseller ResellerKey Whole Number
Sales SalesOrderLineKey Whole Number
Table Column Data type
ResellerKey Whole Number
CustomerKey Whole Number
ProductKey Whole Number
OrderDateKey Whole Number
DueDateKey Whole Number
ShipDateKey Whole Number
SalesTerritoryKey Whole Number
Order Quantity Whole Number
Unit Price Decimal Number
Extended Amount Decimal Number
Unit Price Discount Pct Percentage
Product Standard Cost Decimal Number
Total Product Cost Decimal Number
Sales Amount Decimal Number
SalesTerritory SalesTerritoryKey Whole Number
SalesOrder SalesOrderLineKey Whole Number
6. Model your data to define relationships:
SalesOrder to Sales on SalesOrderLineKey (1:1)
Reseller to Sales on ResellerKey (1:M)
SalesTerritory to Sales on SalesTerritoryKey (1:M)
Product to Sales on ProductKey (1:M)
Customer to Sales on CustomerKey (1:M)
Date to Sales on DateKey to OrderDateKey (1:M)

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.

7. Hide key columns


The typical star schema contains several keys that hold the relationships
between Facts and Dimensions. Normally we don't want to use any key
columns in our reports. Let’s hide the key columns from view, so the
Fields List shows fewer fields, and the data model is easier to use.
Go over all tables and hide any column whose name ends with Key:
Select the Eye icon next to the column and choose Hide in report view.

Hide the following fields.


Table Column
Customer CustomerKey
Date DateKey
MonthKey
Product ProductKey
Reseller ResellerKey
Sales CustomerKey
DueDateKey
OrderDateKey
ProductKey
ResellerKey
SalesOrderLineKey
SalesTerritoryKey
ShipDateKey
SalesOrder SalesOrderLineKey
SalesTerritory SalesTerritoryKey

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.

Create the following hierarchies:


Table Hierarchy name Levels
Customer Geography Country-Region
State-Province
City
Postal Code
Customer
Date Fiscal Year (Fiscal Year)
Quarter (Fiscal Quarter)
Month
Date
Product Products Category
Subcategory
Model
Product
Reseller Geography Country-Region
State-Province
City
Postal Code
Reseller
SalesOrder Sales Orders Sales Order
Sales Order Line
SalesTerritory Sales Territories Group
Country-Region
Region

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:

Old table name New table name


SalesTerritory Sales Territory
SalesOrder Sales Order

10. Write a measure in DAX


Write a measure that calculates the total sales amount by due date on the
sales order instead of the default order date.
This measure uses the USERELATIONSHIP function to activate the
relationship between Sales and Date on DueDate for the context of the
measure. It then uses CALCULATE to sum the Sales Amount in that
context.
1. Select the Sales table in the Field List.
2. On the Home ribbon, select New Measure.
Sales Amount by Due Date = CALCULATE(SUM(Sales[Sales Amount]),
USERELATIONSHIP(Sales[DueDateKey],'Date'[DateKey]))
3. Select the check mark to commit.
11. Add a Profit Column to Sales Table and change its data type:
Profit = [Order Quantity]*[unit price] – [Product standard cost]

12. Build your report

Visual 1: Add a title


1. On the Insert ribbon, select Text Box. Type Executive Summary –
Sales Report.
2. Select the text you typed. Set the font size to 20 and Bold.
3. In the Format text box pane, under Effects, toggle
the Background to Off.
4. Resize the box to fit on one line.

Visual 2: Sales Amount by Date


Next you create a line chart to see which month and year had the highest
sales amount. Drag Sales Amount and Month Field from the Fiscal
hierarchy in the Date table. Select the Line/Area chart. Uncheck Fiscal
Year and Quarter. Add the Sales Amount by Due Date to Y-axis. Open the
Format pane, expand the Lines section, and in Colors, change Sales
Amount by Due Date to a more contrasting color, such as red.

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.

Visual 3: Order Quantity by Reseller Country-Region


Create a map to see in which Country or Region the Resellers have the
highest Order Quantity Amount.
1. Drag the Country-Region field from the Reseller table to a blank
area on your report canvas.
2. Drag the Order Quantity field from the Sales table and drop it on
the map. Make sure Country-Region is in the Location well
and Order Quantity in the Bubble size well.

Visual 4: Sales Amount by Product Category and Reseller


Business type
Create a column chart to investigate which products are sold by what type
of reseller business.
1. In the Fields pane, select Sales Amount from Sales, Product
Category from Product, and Business Type from Reseller.
Change the visualization to a Matrix:
2. Drag the Business Type field from Columns, and put it
under Category in Rows.
3. With the matrix still selected, in the Filters pane, under Business
Type, Select all, then clear the [Not Applicable] box.

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.

Visual 5: Fiscal calendar slicer


Create a slicer to narrow in on performance for each month, quarter, and
year.
1. In the Fields pane, select the Fiscal hierarchy from the Date table
and drag it to the blank area on the left of the canvas.
2. In the Visualizations pane, choose Slicer.

3. In the Fields section of the Visualizations pane,


remove Quarter and Date so only Year and Month are left.

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.

13. Create Tooltip chart


 Open a New Page
 Remove Not Applicable from the Customer by applying Filter
 Create Customer-wise, Order-Quantity, Sales Amount and
Total Product Cost
 Move Sales Amount and Total Product Price to Tool Tip
 Change the aggregation for Sales Amount from Sum to
Average
 Change the Aggregation of Total Product Cost from Sum To
Variance
 Go to File->Options & Settings -> options ->Current Files -
>Report setting to auto scale the Tooltip

14. Adding Report Tooltip


 Open a New Page and Create Country wise Order Quantity
Report and Name this Country-Report
 Open another Page and create Product wise Sales Amount and
Name this as Product-Report
 For the Product-Report Page change the Canvas setting under
Format pane to Tooltip
 Go to View Tab and change the Page-view to Actual Size
 Open the Country-Report Page and define the Tooltip report
under the Format-General pane
 Go to File->Options & Settings -> options -> Preview Features
-> Modern Visual Tooltip

15. Create another Tooltip Report between Product-wise


Maximum Order Quantity and Channel-wise Average Unit Price
16. Filters
There are four standard types of filters that you create in the Filters
pane.
 Visual filter applies to a single visual on a report page.
 Page filter applies to all the visuals on the report page.
 Report filter applies to all pages in the report.
 Drillthrough filter helps you to create a destination report page
that focuses on a specific entity, such as a supplier. From the other
report pages, users can right-click a data point for that entity and
drill through to the focused page. Drill-down filters are automatically
added to the filter pane when you use the drill-down functionality for
a visual in your report.
 Cross-highlighting Selecting a value in one visual highlights the
related data in visuals such as column and bar charts. Cross-
highlighting doesn't remove the unrelated data from those visuals.
The unrelated data is still visible but dimmed.
 Cross-filtering Selecting a value in one visual acts more like a filter
in other visuals, such as line charts, scatter charts, and maps. In
those visuals, only the related data remains visible. The unrelated
data isn't visible, just as you'd see with a filter. Cross-drill filters are
automatically added to the pane when a drill-down filter is passed to
another visual on the report page via the cross-filter or cross-
highlight feature.
 Select Visual-2 and apply Visual filter on Product see impact.
 Apply Page and Report Filter on Product.
 Remove Filters
17. Create a Table on Product and Sales Value. Highlight the
Products in Red Colour if the Sales Value is between 40000 and
60000.
18. Create a Bar Chart to display Category-wise, Product-wise
Sales Amount. Add Legends and Data Values.
19. Create Product-wise Order-quantity and Sales amount.
20. Create a new table Country from Customer Table having
unique Countries.
Country = DISTINCT(Customer[Country-Region])

21. Format the report


 On the View ribbon, select Themes, and change the theme
to Executive.

Visual 2, Sales Amount by Date


1. Select Visual 2, Sales Amount by Date.
2. In the Title section, if you didn't add the DAX measure,
change Text to "Sales Amount by Order Date".
3. Set Text size to 16 pt.
4. On the General tab, toggle Shadow to On.
Visual 3, Order Quantity by Reseller Country-Region
1. Select Visual 3, Order Quantity by Reseller Country-Region.
2. In the Map setting section, change Style to Grayscale.
3. On the General tab, in the Title section, change Text to "Order
Quantity by Reseller Country-Region".
4. Set Text size to 16 pt.
5. Also on the General tab, toggle Shadow to On.
Visual 4, Sales Amount by Product Category and Reseller
Business Type
1. Select Visual 4, Sales Amount by Product Category and Reseller
Business Type.
2. On the General tab, in the Title section, change Text to "Sales
Amount by Product Category and Reseller Business Type".
3. Set Text size to 16 pt.
4. Also on the General tab, toggle Shadow to On.
Visual 5, Fiscal calendar slicer
1. Select Visual 5, Fiscal calendar slicer.
2. In the Slicer settings section, under Selection, toggle Show
"Select all" option to On.
3. In the Slicer header section, set Text size to 16 pt.

Add a background shape for the title


1. On the Insert ribbon, select Shapes > Rectangle.
2. Place it at the top of the page, and stretch it to be the width of the
page and height of the title.
3. In the Style pane, in the Border section,
change Transparency to 100%.
4. In the Fill section, change Fill color to Theme color 5 #6B91C9
(blue).
5. On the Format ribbon, select Send backward > Send to back.
6. Select the text in Visual 1, the title, and change Font
color to White.
Save and Publish the Report

You might also like