0% found this document useful (0 votes)
440 views

20779A ENU Companion

20779A ENU Companion

Uploaded by

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

20779A ENU Companion

20779A ENU Companion

Uploaded by

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

O F F I C I A L M I C R O S O F T L E A R N I N G P R O D U C T

20779A
Analyzing Data with Excel
ii Analyzing Data with Excel

Information in this document, including URL and other Internet Web site references, is subject to change
without notice. Unless otherwise noted, the example companies, organizations, products, domain names,
e-mail addresses, logos, people, places, and events depicted herein are fictitious, and no association with
any real company, organization, product, domain name, e-mail address, logo, person, place or event is
intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the
user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in
or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical,
photocopying, recording, or otherwise), or for any purpose, without the express written permission of
Microsoft Corporation.

Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property
rights covering subject matter in this document. Except as expressly provided in any written license
agreement from Microsoft, the furnishing of this document does not give you any license to these
patents, trademarks, copyrights, or other intellectual property.

The names of manufacturers, products, or URLs are provided for informational purposes only and
Microsoft makes no representations and warranties, either expressed, implied, or statutory, regarding
these manufacturers or the use of the products with any Microsoft technologies. The inclusion of a
manufacturer or product does not imply endorsement of Microsoft of the manufacturer or product. Links
may be provided to third party sites. Such sites are not under the control of Microsoft and Microsoft is not
responsible for the contents of any linked site or any link contained in a linked site, or any changes or
updates to such sites. Microsoft is not responsible for webcasting or any other form of transmission
received from any linked site. Microsoft is providing these links to you only as a convenience, and the
inclusion of any link does not imply endorsement of Microsoft of the site or the products contained
therein.
2017 Microsoft Corporation. All rights reserved.

Microsoft and the trademarks listed at


http://www.microsoft.com/about/legal/en/us/IntellectualProperty/Trademarks/EN-US.aspx are trademarks
of the Microsoft group of companies. All other trademarks are property of their respective owners

Product Number: 20779A

Part Number (if applicable):


Released: 02/2017
Data Analysis in Excel 1-1

Module 1
Data Analysis in Excel
Contents:
Lesson 1: Classic Data Analysis with Excel 2

Lesson 2: Excel PivotTables 4

Module Review and Takeaways 6


Lab Review Questions and Answers 7
1-2 Analyzing Data with Excel

Lesson 1
Classic Data Analysis with Excel
Contents:
Demonstration: Connecting Excel to SQL Server 2016 3
Data Analysis in Excel 1-3

Demonstration: Connecting Excel to SQL Server 2016


Demonstration Steps
Connect to SQL Server Express and Import Data

1. Ensure that the 20779A-MIA-BI virtual machine is running, and then log on to 20779A-MIA-BI as
Admin with the password Pa55w.rd.

2. Start Excel 2016.

3. On the Welcome screen, click Blank workbook.

4. On the ribbon, click the Data tab, click Get External Data, click From Other Sources, and then click
From SQL Server.

5. In the Data Connection wizard, in the Server name text box, type MIA-BI\SQLExpress.

6. Ensure that Use Windows authentication is selected, and then click Next.

7. In the list of databases, select AdventureWorksLT2012.

8. In the list of tables, click Product, and then click Next.

9. Click Finish.

10. In the Import Data dialog, click OK. Excel imports and displays product data from the Adventure
Works database.
1-4 Analyzing Data with Excel

Lesson 2
Excel PivotTables
Contents:
Demonstration: Creating a Simple PivotTable 5
Data Analysis in Excel 1-5

Demonstration: Creating a Simple PivotTable


Demonstration Steps
Create a PivotTable That Analyses Product Data

1. Ensure that the 20779A-MIA-BI virtual machine is running, and then log on to 20779A-MIA-BI as
Admin with the password Pa55w.rd.

2. Open File Explorer and browse to D:\Demofiles\Mod01.

3. Double-click ProductData.xslx.

4. On the ribbon, click the Insert tab, and then click PivotTable.

5. In the Create PivotTable dialog, in the Table/Range text box, type Products.

6. Ensure that New Worksheet is selected, and then click OK.


7. Select a cell in the new PivotTable.

8. On the ribbon, on the Analyze tab, click PivotTable; in the PivotTable Name text box, type
ProductAnalysis.

9. In the PivotTable Fields task pane, in the list of fields, right-click ProductCategory, and then click
Add to row labels.

10. In the list of fields, right-click ListPrice, and then click Add to Values.

11. In the list of fields, right-click Color, and then click Add to Column Labels.
1-6 Analyzing Data with Excel

Module Review and Takeaways


Review Question(s)
Question: You have a database table that contains sales data from the last five years. There are
approximately 1.5 million rows in the table. You want to analyze sales data from 2015 in Excel. What
technical issues can you foresee and how can you solve them?

Answer: You cannot import 1.5 million rows into Excel because of the 1 million-row limit on an
Excel spreadsheet. Instead of importing the whole table, you must use a query to select only
records from 2015. It seems likely that this would return less than 1 million rows but you should
check. You can build a query by using the Excel query editor or work with a database
administrator, who could provide a database view that returned only 2015 data.
Data Analysis in Excel 1-7

Lab Review Questions and Answers


Lab: Building a Classic Excel Dashboard
Question and Answers
Lab Review
Question: In Exercise 1, you merged columns from the SalesOrderHeaders, Customers, and Addresses
tables into the SalesItems table. What is the total number of calls to the VLOOKUP() function made in the
completed SalesItems table?

Answer: 2168

Question: The original database includes a table named Product. This table uses the ProductID as a
primary key and has a column called Name. How could you enable users to select a product name in the
slicer instead of a product ID?

Answer: Import the Product table into a new table in the Excel spreadsheet. Add a new column
to the SalesItems table called ProductName. Use VLOOKUP() calls to merge the Name column
from the Products table by matching the ProductID column of SalesItems with the ProductID
column of Products.

The Excel Data Model 2-1

Module 2
The Excel Data Model
Contents:
Lesson 1: Using an Excel Data Model 2

Lesson 2: DAX 5

Lab Review Questions and Answers 9


2-2 Analyzing Data with Excel

Lesson 1
Using an Excel Data Model
Contents:
Demonstration: Viewing Data in an Excel Data Model 3
The Excel Data Model 2-3

Demonstration: Viewing Data in an Excel Data Model


Demonstration Steps
1. In the factSalesTable sheet, click cell A1.

2. On the ribbon, click Insert, then click Table.

3. In the Create Table window, accept the default options and click OK.

4. On the ribbon, in the Properties section, highlight Table1 and type FactSalesTable, and then press
Enter.

5. Repeat steps 1 to 4 for the following sheets, replacing the default table name with the title of each
sheet:

DimCustomerTable

DimRegionTable

DimProductTable

DimProductCategoryTable

DimProductSubcategoryTable

6. Click the factSalesTable tab.

7. On the ribbon, click Insert, and then click PivotTable.


8. In the Create PivotTable window, click the Add this data to the Data Model check box, leave other
options at their defaults, and click OK.

9. In the PivotTable Fields window, scroll the Choose fields to add to report list.

Note: only the FactSalesTable columns are available.

10. On the ribbon, click Data and then click Manage Data Model.

Note: the FactSalesTable data is now in the data model in the Power Pivot for Excel -
Mod2_Demo1.xlsx window.

11. Select the Mod2_Demo1.xlsx - Excel window.

12. In the PivotTable Fields window, click All and scroll the Choose fields to add to report list.

Note: all the tables and their columns are available, but only FactSalesTable is active. Other tables
only become active when one or more of their columns is being used in the PivotTable.

13. Navigate to the Power Pivot for Excel - Mod2_Demo1.xlsx window.

Note: only the FactSalesTable is in the model.

14. Select the Mod2_Demo1.xlsx - Excel window.


15. Click the sheet dimCustomerTable, click anywhere in the table, then, on the ribbon, click Power Pivot,
and then click Add to Data Model.

Note: in the Power Pivot for Excel - Mod2_Demo1.xlsx window, the DimCustomerTable is now part of
the data model.
2-4 Analyzing Data with Excel

16. On the Power Pivot for Excel - Mod2_Demo1.xlsx window ribbon, click Diagram View. The two tables
are in the diagram of the model.

Note: there is no relationship between them.

17. Click and hold CustomerKey in FactSalesTable and drag it to CustomerKey in DimCustomerTable.

Note: a one-to-many relationship (one denoted by a 1 and many denoted by an *) is created. That
means that one customer can make multiple purchases.

18. Repeat steps 14 and 15 for the following tables:

DimRegionTable

DimProductTable

DimProductSubcategoryTable

DimProductCategoryTable

19. Repeat step 17 to create the following relationships:


DimRegionTable[GeographyKey] to DimCustomerTable[GeographyKey]

DimProductTable[ProductKey] to FactSalesTable[ProductKey]

DimProductSubcategoryTable[ProductSubcategoryKey] to
DimProductTable[ProductSubcategoryKey]

DimProductCategoryTable[ProductCategoryKey] to
DimProductSubcategoryTable[ProductCategoryKey]
20. In the Diagram View, click the relationship line between FactSalesTable and DimProductTable.

Note: the related columns are highlighted.


21. Close Excel without saving changes.
The Excel Data Model 2-5

Lesson 2
DAX
Contents:
Demonstration: Working with DAX 6
2-6 Analyzing Data with Excel

Demonstration: Working with DAX


Demonstration Steps
View a Data Model

1. Click Enable Editing, and then click Enable Content, should these notification messages appear.

Note: the workbook appears empty. This is because the data has been imported from SQL Server
directly into the data model.

2. On the ribbon, click Data, and then click Manage Data Model.

Note: the model has seven tables in seven sheets.


3. On the ribbon, click Diagram View.

Note: the relationships between the models have already been defined.

Add a Calculated Column

1. On the ribbon, click Data View, and then click the factSalesTable tab.

2. In the sheet, click the column heading Add Column.


3. Type = (equal), then click the column heading Order Quantity, type * (asterisk), then click the column
heading List Price, and press Enter.

Note: the formula appears in the formula bar and the result of the calculation Order Quantity,
multiplied by List Price, appears in each row of the new column. This is an example of row context.

4. Double-click the column heading Calculated Column 1, type Revenue and press Enter.

5. On the ribbon, in the Formatting section, click $ (dollar), and then click $ English (United States).

Note: all values in the Revenue column are now formatted to USD.
6. Click the column heading Add Column, insert the formula =[OrderQuantity]*[Product Cost], and
press Enter.

7. Click the column heading Calculated Column 1, type Cost, and press Enter.

Use Calculated Columns in a PivotTable

1. Navigate to the Excel workbook Mod2_Demo2.xlsx.

2. Click New sheet.


3. On the ribbon, click Insert, and then click PivotTable.

Note: in the Create PivotTable, the radio button Use this workbooks Data Model is selected. Excel has
recognized that there is already a data model.

4. In the Create PivotTable window, leave all the options at their default settings and click OK.

5. In the PivotTable Fields window, locate and expand factSalesTable. Scroll to Revenue and drag this
field to the Values pane.

6. In the PivotTable Fields window, locate and expand dimRegionTable. Scroll to Country and drag this
field to the Rows pane.

Note: the PivotTable now shows revenue values for each country.
The Excel Data Model 2-7

7. In the PivotTable Fields window, locate and expand dimProductCategoryTable, scroll to


ProductCategoryName and drag this field to the Columns pane.

Note: the PivotTable now shows the product categories in the columns, so that you have a revenue
by country, by product category.
Add a Filter

1. In the PivotTable Fields window, locate and expand dimDateTable, right-click CalendarYear, and
click Add as Slicer.
2. In the CalendarYear slicer window, click 2007, and then click 2006.

Note: the slicer is a filter that shows the PivotTable results for the year that you select.

Work with Measures

1. In the Values pane, click Sum of Revenue.

Note: this is an implicit measure. The field dragged to the Values pane was factSalesTable[Revenue].
Excel automatically created a measure that defaults to the SUM function.

2. In the drop-down menu, click Value Field Settings.


3. Scroll to show the other calculation functions that are available: Count, Average, Max, Min, StdDev,
StdDevp, Var, Varp, and Distinct Count.

4. In the Value Field Settings window, click Cancel.


5. In the PivotTable Fields window, locate factSalesTable and drag CustomerKey to the Values pane.

Note: the PivotTable now shows the Sum of CustomerKey, which is meaningless.
6. Click Sum of CustomerKey and click Value Field Settings.

7. In the Value Field Settings window, scroll down, then click Distinct Count, and then click OK.

Note: the Distinct Count of CustomerKey column now shows the number of customers who have
generated orders for each product in each country.

Create Explicit Measures

1. Navigate to the Power Pivot for Excel - Mod2_Demo2.xlsx window.

2. Click anywhere in the Values section of the screen.

Note: the Values section is the empty area underneath the data.
3. Type TotalRevenue:=sum(rev, then double-click [Revenue] in the drop-down list, then type ) and
press Enter.

4. On the ribbon, in Formatting, click $ (dollar) and click $ English (United States).

5. In the Values section, below the TotalRevenue: measure, type TotalCost:=sum(cos, then double-click
factSalesTable[Cost] in the drop-down list, then type ) and press Enter.

6. On the ribbon, in Formatting, click $ (dollar) and click $ English (United States).

7. In the Values section, below the TotalCost: measure, type Margin%:=(, then click the TotalRevenue:
measure, then type - (minus), then click the TotalCost: measure, type )/, and then click the
TotalCost: measure and press Enter.
2-8 Analyzing Data with Excel

8. On the ribbon, in Formatting, click %.

Note: this measure refers to other measures, not just columns in the table.

Work with Explicit Measures

1. Navigate to the Mod2_Demo2.xlsx -Excel window.

2. Drag Sum of Revenue and Distinct Count of CustomerKey out of the Values pane to the sheet to
remove them.

3. In the PivotTable Fields table list, locate and expand FactInternetSales, then scroll to the bottom of
the list.

4. Drag the measures TotalRevenue, TotalCost, and Margin% into the Values pane.

Note: these are examples of filter context.

5. Close Excel without saving changes.


The Excel Data Model 2-9

Lab Review Questions and Answers


Lab: Explore an Excel Data Model
Question and Answers
Question: When you added FactInternetSales[Order Revenue] to the Values pane of the PivotTable,
what was automatically created?

Answer: An implicit measure that produced the sum of Order Revenue.

Question: Explicit measures require a name. What symbol is used to denote the end of the name and the
start of the measure formula?
Answer: A colon (:) denotes the end of an explicit measures name.

Importing Data from Files 3-1

Module 3
Importing Data from Files
Contents:
Lesson 1: Importing Data into Excel 2

Lesson 2: Shaping and Transforming Data 4

Lesson 3: Loading Data 6


Module Review and Takeaways 8

Lab Review Questions and Answers 9


3-2 Analyzing Data with Excel

Lesson 1
Importing Data into Excel
Contents:
Question and Answers 3
Importing Data from Files 3-3

Question and Answers


Put the following steps in the correct order by numbering each one.

Steps

Import data into the Query Editor.

Transform data using the Query Editor.

Load data into a workbook or a Data Model.

Answer:

Steps

1 Import data into the Query Editor.

2 Transform data using the Query Editor.

3 Load data into a workbook or a Data Model.


3-4 Analyzing Data with Excel

Lesson 2
Shaping and Transforming Data
Contents:
Demonstration: Import and Transform Data 5
Importing Data from Files 3-5

Demonstration: Import and Transform Data


Demonstration Steps
Import a CSV file

1. Ensure that the 20779A-MIA-BI virtual machine is running, and then log on as Admin with the
password Pa55w.rd.

2. Start Excel 2016.

3. Open a Blank workbook.

4. From the Data tab, and the Get and Transform group, click New Query.

5. Click From File, and then click From CSV.

6. In the Import Data dialog box, navigate to D:\Demofiles\Mod03.


7. Select the Casualties_2015.csv file, and then click Import.

8. The Query Editor will open in a new window.

Transform the Data


1. Right-click the Casualty_Severity column, click Change Type, and then click Text.

2. Right-click the Casualty_Severity column, and then click Replace Values.

3. In the Replace Values text box, under the Value to Find text box, type 3. In the Replace With text
box, type Slight, and then click OK.

4. Repeat steps 2 and 3. Replace 2 with Serious, and replace 1 with Fatal.

5. Right-click the Sex_of_Casualty column, click Change Type, and then click Text.

6. Right-click the Sex_of_Casualty column, and then click Replace Values.

7. In the Replace Values text box, under Value to Find, type 1. In Replace With, type Male, and then
click OK.

8. Repeat steps 6 and 7 to replace 2 with Female.

Filter the Data

1. Select the Sex_of_Casualty column.


2. Click the down arrow in the column heading.

3. Click Select All to clear all values.

4. Click Female to select only rows with the value Female.

5. Click OK.

6. Notice that the header icon has changed to a filter with a dot next to it, to show that a filter has been
applied.
7. Close the Query Editor. Click Discard when prompted.

8. Close the spreadsheet without saving.


3-6 Analyzing Data with Excel

Lesson 3
Loading Data
Contents:
Resources 7
Importing Data from Files 3-7

Resources
Loading Data

Best Practice: You can choose to load data from the preview window when you import
data. The same two options, Load and Load To, are available at preview. Unless you are certain
that the data is in the format you require, use Query Editor to check and modify data as needed.
3-8 Analyzing Data with Excel

Module Review and Takeaways


Best Practice
Data Models make it easier to work with data that is in different files, and different formats.

Review Question(s)
Question: Which import method could you use to analyze data that is being added to on a regular basis.

Answer: Import From Folder.


Importing Data from Files 3-9

Lab Review Questions and Answers


Lab: Importing Data
Question and Answers
Lab Review
Question: What are Query Settings used for?

Answer: Query Settings are a step-by-step list of all the changes to the data.

Question: When importing data from a folder, what must you do to update Excel when files are added to,
or deleted from, the folder?

Answer: You must click Refresh All.



Importing Data from Databases 4-1

Module 4
Importing Data from Databases
Contents:
Lesson 2: Previewing, Shaping, and Transforming Data 2

Lesson 3: Loading Data 4

Lesson 4: Table Relationships and Hierarchies 6


Module Review and Takeaways 8

Lab Review Questions and Answers 9


4-2 Analyzing Data with Excel

Lesson 2
Previewing, Shaping, and Transforming Data
Contents:
Demonstration: Formulating a Query 3
Importing Data from Databases 4-3

Demonstration: Formulating a Query


Demonstration Steps
Create a New Query, Transform Data, and Load Data to a Table

1. Ensure that the 20779A-MIA-BI virtual machine is running and then log on to 20779A-MIA-BI as
Admin with the password Pa55w.rd.

2. Start Excel 2016.

3. Click Blank workbook.

4. On the ribbon, click the Data tab.

5. Click New Query, click From Database, and then click From SQL Server Database.

6. In the Microsoft SQL Database dialog box, in the Server text box, type MIA-BI\SQLExpress.
7. In the Database (optional) text box, type AdventureWorksLT2012, and then click OK.

8. If the Access a Microsoft SQL Database dialog box appears, ensure Use my current credentials is
selected, and then click Connect.

9. If the Encryption Support dialog box appears, click OK.

10. In the Navigator dialog box, under AdventureWorksLT2012, click SalesLT.SalesOrderHeader, and
then click Edit.

11. In the ribbon, on the Home tab, click Choose Columns.

12. In the Choose Columns dialog box, clear the (Select All Columns) check box.

13. Select the SalesOrderID, OrderDate, PurchaseOrderNumber, AccountNumber, and TotalDue


check boxes, and then click OK.

14. In the Query Editor, click the PurchaseOrderNumber column header.

15. On the ribbon, click Replace values.

16. In the Replace Values dialog box, in the Value To Find text box, type PO, and then click OK. Excel
removes the string PO from the column values.

17. Click the AccountNumber column header.

18. On the ribbon, click Split Column, and then click By Delimiter.

19. In the Split Column by Delimiter dialog box, in the Select or enter delimiter drop-down list, click -
-Custom--.
20. In the second text box, type -.

21. Select At each occurrence of the delimiter, and then click OK.

22. Click the TotalDue column header.

23. On the ribbon, click the Transform tab, click Rounding, and then click Round.

24. In the Round dialog box, in the Decimal Places text box, type 2, and then click OK.

25. Click the Home tab, and then click Close and Load. Excel executes the queries and loads the results
into a new table.
4-4 Analyzing Data with Excel

Lesson 3
Loading Data
Contents:
Demonstration: Adding a Date Table 5
Importing Data from Databases 4-5

Demonstration: Adding a Date Table


Demonstration Steps
Add an Excel Table to the Data Model and Use a Date Table

1. Ensure that the 20779A-MIA-BI virtual machine is running, and then log on to 20779A-MIA-BI as
Admin with the password Pa55w.rd.

2. Open Windows Explorer and browse to D:\Demofiles\Mod04.

3. Double-click DateTableExample.xlsx.

4. In Sheet 1, click any cell in the table.

5. On the ribbon, click the Power Pivot tab, and then click Add to Data Model.

6. In the Power Pivot for Excel window, on the ribbon, click the Design tab.
7. Click Date Table, and then click New.

8. On the ribbon, click the Home tab, and then click Diagram View.

9. Drag from the OrderDate column in the SalesDetails table to the Date column in the Calendar
table.

10. Click File, and then click Close.

11. On the ribbon, click the Home tab.


12. Click Insert, and then click Insert Sheet.

13. On the ribbon, click the Insert tab, and then click PivotTable.

14. In the Create PivotTable dialog box, select Use this workbooks Data Model, and then click OK.

15. In the PivotTable Fields task pane, expand the SalesDetails table.

16. Right-click TotalDue, and then click Add to Values.

17. Expand the Calendar table.


18. Right-click Date Hierarchy, and then click Add to Row Labels.

19. In the Calendar table, expand More Fields.

20. Right-click Day of Week, and then click Add to Column Labels.

21. Navigate and describe the values in the new PivotTable to students.
4-6 Analyzing Data with Excel

Lesson 4
Table Relationships and Hierarchies
Contents:
Demonstration: Creating Relationships and Hierarchies 7
Importing Data from Databases 4-7

Demonstration: Creating Relationships and Hierarchies


Demonstration Steps
Create a Hierarchy in a Data Model and Use the Data in a PivotTable

1. Ensure that the 20779A-MIA-BI virtual machine is running, and then log on to 20779A-MIA-BI as
Admin with the password Pa55w.rd.

2. Open Windows Explorer and browse to D:\Demofiles\Mod04.

3. Double-click HierarchyExample.xlsx.

4. If the message External data connections have been disabled appears, click Enable Content.

5. On the ribbon, click the Data tab, and then click Manage Data Model.

6. In the Power Pivot for Excel window, on the ribbon, click Diagram View.
7. In the SalesLT Address table, at the top right, click the Create Hierarchy button.

8. Type Location, and then press Enter.

9. Drag the CountryRegion column to the Location hierarchy.


10. Drag the StateProvince column to the Location hierarchy.

11. Drag the City column to the Location hierarchy.

12. Click File, and then click Close.

13. On the ribbon, click the Insert tab, and then click PivotTable.

14. In the Create PivotTable dialog box, ensure that Use this workbooks Data Model is selected, and
then click OK.

15. In the PivotTable Fields task pane, expand the SalesLT Address table.

16. Right-click the Location hierarchy, and then click Add to Row Labels.

17. Expand the SalesLT SalesOrderHeader table.


18. Right-click TotalDue, and then click Add to Values.

19. In the new PivotTable, expand United States, and then expand California to demonstrate drilling
down into a hierarchy.
4-8 Analyzing Data with Excel

Module Review and Takeaways


Question: What information can Excel add to a Data Model automatically when importing from a
database that it cannot add automatically when importing from CSV files?

Answer: Excel can create relationships automatically when you import from a database because
those relationships can be defined in the original database. CSV files do not include any way to
describe a relationship to other data.
Importing Data from Databases 4-9

Lab Review Questions and Answers


Lab: Importing Data from Multiple Sources
Question and Answers
Lab Review
Question: When you connected to the CSV data files, why did the Query Editor identify all columns as
text columns?

Answer: Initially, the imported data included the CSV files header lines as rows of data. This
prevented the Query Editor from identifying the column types as any type other than text.

Question: The Calendar date table that you add in Exercise 2 includes a hierarchy based on the Year,
Month, and Day columns. Are there any other columns that could be used to construct a hierarchy in the
Data Model?

Answer: In the database, each order consists of one row in the SalesOrderHeader table and one
or more rows in the SalesOrderDetail table (one row for each product in the order). Therefore, in
the SalesOrderDetail table, you could add a hierarchy based on the SalesOrderID and
SalesOrderDetailID columns. This would enable you to drill down from whole orders to individual
order lines in your analysis.

Importing Data from Excel Reports 5-1

Module 5
Importing Data from Excel Reports
Contents:
Lesson 2: Transforming Excel Report Data 2

Module Review and Takeaways 5

Lab Review Questions and Answers 6


5-2 Analyzing Data with Excel

Lesson 2
Transforming Excel Report Data
Contents:
Resources 3
Demonstration: Creating an Excel Table from Report Data 3
Importing Data from Excel Reports 5-3

Resources
Removing Unnecessary Rows

Common Issues and Troubleshooting Tips


Common Issue Troubleshooting Tip

The Does Not filters will remove rows Replace any null values before filtering.
containing null values in addition to those For example, use the Fill Down or Fill Up
matching the specified text. commands to populate null rows first.

Demonstration: Creating an Excel Table from Report Data


Demonstration Steps
Show the Original Report

1. Using File Explorer, browse to the D:\Demofiles\Mod05 folder, and then double-click
AdventureWorks_Sales.xlsx.
2. Examine the report, noting that it contains several worksheets, each displaying the sales reports for a
different year. Sales figures are broken down by product within each category, and are reported for
each month.

Import the Report Data

1. In Excel, create a new blank workbook.

2. On the Data ribbon, click New Query, click From File, and then click From Workbook.
3. In the Import Data dialog box, browse to the D:\Demofiles\Mod05 folder, and then double-click
AdventureWorks_Sales.xlsx.

4. In the Navigator window, note that you can specify the worksheet from which to import the report.
5. Click 2015 to select the report for 2015.

6. Under the preview pane, click Edit. The Query Editor starts.

7. Highlight the unformatted data in the main window, and the APPLIED STEPS list in the Query
Settings pane.

Organize Rows, Headers, and Columns

1. Examine the top two rows in the main window. These rows contain text information rather than data.

2. On the Home ribbon, click Reduce Rows, click Remove Rows, and then click Remove Top Rows.

3. In the Remove Top Rows dialog box, in the Number of rows box, type 2, and then click OK. Note
that the top two rows disappear.
4. Examine rows 6 and 23. These rows are empty.

5. On the Home ribbon, click Reduce Rows, click Remove Rows, and then click Remove Blank Rows.
Rows 6 and 23 should be deleted.

6. Examine the column headings in row 1.

7. On the Home ribbon, click Use First Row As Headers. Notice the new column headings.

8. Scroll the main window to the right to display the columns headed Column15 and 2015 Total.
5-4 Analyzing Data with Excel

9. Select both columns, and then on the Home ribbon, click Remove Columns.

Transform the Data

1. Select the Category column.

2. On the Transform ribbon, click Fill, and then click Down. Notice that the null values in this column
are replaced with the category name.

3. Examine rows 4 and 20. These rows contain subtotals for the sales for each month in each category.
They are not required.

4. Similarly, examine 5 and 21. These rows contain a set of headings that are redundant.

5. Click the drop-down arrow in the header of the Category column, click Text Filters, and then click
Does Not Begin With.

6. In the Filter Rows dialog box, in the second box in the first row, type Category. Make sure the And
button is selected, in the first drop-down list box on the second type select does not begin with, in
the second box on the second row type Totals, and then click OK.

7. Verify that the additional headings and totals rows have disappeared.
8. Select the columns for Jan through to Dec.

9. Right-click on the highlighted columns, and click Unpivot Columns. The data for each row is
converted into 12 rows; one for each month.
10. Right-click the Attribute column header, click Rename, type Month, and then press Enter.

11. Right-click the Value column header, click Rename, type Sales, and then press Enter.

12. Verify that the names of the two new columns generated by the unpivot operation have changed.
Examine the Power Query Formula Language Code

1. In the Query Settings pane, point out the APPLIED STEPS.

2. Click each step in turn, and notice that the main window displays the results of the steps up to that
point. You can edit or delete any steps if they do not work as expected.

3. On the Home ribbon, click Advanced Editor.

4. In the Advanced Editor dialog box, examine the code generated by the Query Editor, and then click
Cancel.

Transfer the Data to the Excel Worksheet

1. On the Home ribbon, click Close & Load.

2. Verify that the transformed data is loaded into the Excel worksheet. It should comprise 444 rows.

3. Note that you can edit the query; in the Workbook Queries pane, double-click the query to open
the Query Editor again.
4. Close Excel, without saving any changes.
Importing Data from Excel Reports 5-5

Module Review and Takeaways


Question: Why would you import data from an existing formatted Excel report?

Answer: Typically, you would want to import data directly from the data source, such as a SQL
database or text file. When this is not available, you might need to improviseone of the ways to
do that is to import data from an existing formatted Excel report.
5-6 Analyzing Data with Excel

Lab Review Questions and Answers


Lab: Importing Data from a Report
Question and Answers
Lab Review
Question: Which feature in Query Editor should you use to transform selected columns into attribute-
value pairs where columns become rows?

( ) Fill

( ) Reverse Rows

( ) Unpivot Columns

( ) Merge Columns

( ) Transpose

Answer:

( ) Fill
( ) Reverse Rows

() Unpivot Columns

( ) Merge Columns
( ) Transpose

Question: Which feature in Query Editor should you use to remove rows based on their values?

( ) Remove Rows

( ) Remove Duplicates

( ) Replace Values

( ) Filters

( ) Extract

Answer:

( ) Remove Rows

( ) Remove Duplicates

( ) Replace Values

() Filters

( ) Extract
Creating and Formatting Measures 6-1

Module 6
Creating and Formatting Measures
Contents:
Lesson 1: Data Analysis Expressions 2

Lesson 2: Measures 4

Lesson 3: Advanced DAX Functions 6


Module Review and Takeaways 8

Lab Review Questions and Answers 9


6-2 Analyzing Data with Excel

Lesson 1
Data Analysis Expressions
Contents:
Demonstration: Adding a Calculated Column in the Data Model 3
Creating and Formatting Measures 6-3

Demonstration: Adding a Calculated Column in the Data Model


Demonstration Steps
Add a Calculated Column to the Data Model

1. Ensure that the 20779A-MIA-BI virtual machine is running, and then log on to 20779A-MIA-BI as
Admin with the password Pa55w.rd.

2. Open Windows Explorer and browse to D:\Demofiles\Mod06\.

3. Double-click CaclulatedColumn.xlsx.

4. On the ribbon, on the Data tab, click Manage Data Model.

5. In the Power Pivot for Excel window, in the ribbon, click the Design tab, and then click Add.

6. Type the following formula, and then press Enter:

=DIVIDE([SubTotal], SUM([SubTotal]))

7. Right-click the Calculated Column 1 column header, and then click Rename Column.

8. Type % Size of Order, and then press Enter.

9. On the ribbon, click the Home tab, and then, in the Formatting section, click %.
10. Scroll through the new column and determine the largest order as a proportion of the whole revenue.
6-4 Analyzing Data with Excel

Lesson 2
Measures
Contents:
Demonstration: Adding and Using Measures 5
Creating and Formatting Measures 6-5

Demonstration: Adding and Using Measures


Demonstration Steps
Create and Use a Measure

1. Ensure that the 20779A-MIA-BI virtual machine is running, and then log on to 20779A-MIA-BI as
Admin with the password Pa55w.rd.

2. Open Windows Explorer and browse to D:\Demofiles\Mod06\.

3. Double-click Measure.xlsx.

4. On the ribbon, click the Data tab, and then click Manage Data Model.

5. In the Power Pivot for Excel window, in the tabs at the bottom, click the SalesLT Product table.

6. On the ribbon, ensure that the Calculation Area button is selected.


7. In the calculation area at the bottom, click any empty cell.

8. Type the following formula, and then press Enter:

% of Average Product Price:=AVERAGE([ListPrice])/AVERAGEX(ALL('SalesLT Product'),


[ListPrice])

9. Click the new measure, then on the ribbon, in the Formatting section, click %.

10. Close the Data Model.

11. On the ribbon, click Insert and then click PivotTable.


12. In the Create PivotTable dialog, ensure that Use this workbooks Data Model is selected, and then
click OK.

13. In the PivotTable Fields task pane, expand the SalesLT ProductCategory table.
14. Right-click the Name column, and then click Add to Row Labels.

15. Expand the SalesLT Product table.

16. Right-click ListPrice, and then click Add to Values.


17. In the Values list, click the down arrow to the right of Sum of ListPrice, and then click Value Field
Settings.

18. In the Summarize value field by list, click Average, and then click OK.

19. Scroll down the PivotTable. In the Grand Total row, point out that the average price for all products
is $744.60.

20. In the PivotTable Fields task pane, right-click the % of Average Product Price measure, and then
click Add to Values.

21. Examine the results. Point out that the first column shows the average list price for each category. The
second column shows that number as a percentage of $744.60, the average price for all products.
6-6 Analyzing Data with Excel

Lesson 3
Advanced DAX Functions
Contents:
Demonstration: Adding a Complex Measure 7
Creating and Formatting Measures 6-7

Demonstration: Adding a Complex Measure


Demonstration Steps
Add a Complex Measure to the Data Model

1. Ensure that the 20779A-MIA-BI virtual machine is running, and then log on to 20779A-MIA-BI as
Admin with the password Pa55w.rd.

2. Open Windows Explorer and browse to D:\Demofiles\Mod06\.

3. Double-click FindFunction.xlsx.

4. On the ribbon, click the Data tab, and then click Manage Data Model.

5. At the bottom of the Power Pivot for Excel window, click the SalesLT SalesOrderDetail tab.

6. In the calculation area at the bottom of the window, click any empty cell.
7. Type the following formula, and then press Enter:

Total Jersey Sales:=SUMX(FILTER('SalesLT SalesOrderDetail', FIND("Jersey",


RELATED('SalesLT Product'[Name]), 1, -1) <> -1), [LineTotal])

8. Close the Power Pivot for Excel window.


9. In Excel, in the ribbon, click the Insert tab, and then click PivotTable.

10. In the Create PivotTable dialog, ensure that Use this workbooks Data Model is selected, and then
click OK.

11. In the PivotTable Fields task pane, expand the SalesLT Product table.

12. Right-click Name, and then click Add to Row Labels.

13. Expand the SalesLT SalesOrderDetail table.


14. Right-click Total Jersey Sales, and then click Add to Values.

15. Examine the totals in the PivotTable.

16. Close Excel, without saving any changes.


6-8 Analyzing Data with Excel

Module Review and Takeaways


Question: You have a column of text values that includes blank values and integers. You want to return
the number of rows in the column including those that contain strings, blanks, and numbers. What DAX
function should you use?

Answer: Use the COUNTROWS function. Remember that the COUNT function only counts
numbers, and the COUNTA function does not count blanks.

Question: You have the following formula in a custom measure:

Total Sales:=CALCULATE('2016Sales', SUM([LineTotal]))

How can you rewrite this formula by using only one DAX function?

Answer: Total Sales:=SUMX('2016Sales', [LineTotal])


Creating and Formatting Measures 6-9

Lab Review Questions and Answers


Lab: Creating Measures by Using Advanced DAX Functions
Question and Answers
Lab Review
Question: What was the total percentage sales change you calculated for all countries?

Answer: 25.96%

Question: What was the percentage year to date sales change you calculated for France?

Answer: -46.23%

Question: What was VanArsdels market share in Germany?

Answer: 64.62%

Visualizing Data in Excel 7-1

Module 7
Visualizing Data in Excel
Contents:
Lesson 1: Using PivotCharts 2

Lesson 2: Using Cube Functions 8

Lesson 3: Creating Charts for Cube Functions 14


Module Review and Takeaways 19

Lab Review Questions and Answers 21


7-2 Analyzing Data with Excel

Lesson 1
Using PivotCharts
Contents:
Resources 3
Demonstration: Creating a PivotChart 3
Demonstration: Adding a Slicer to a PivotChart 4
Demonstration: Creating a Key Performance Indicator 5
Visualizing Data in Excel 7-3

Resources
Creating PivotCharts

Best Practice: If you are constructing a data model to build visualizations, consider hiding
data that is not relevant to the visualizations. Examples include primary and foreign key identity
fields (for example, a product ID or a sales order ID). These fields are used to relate data between
tables together, but the values that they contain are not meaningful on any report or chart.
Similarly, consider creating measures to abstract data and make it easier to consume in a
visualization. For example, a sales table will have a record for every sale, but you could also
include a measure that calculates the year-to-date sales for given criteria.

Demonstration: Creating a PivotChart


Demonstration Steps
Create the Chart
1. Start Excel 2016.
2. Open the workbook VanArsdel_Sales_Demo1.xlsx in the D:\Demofiles\Mod07 folder.

This workbook contains a data model holding sales data for the VanArsdel organization. VanArsdel
sells products manufactured by a variety of companies. Products are grouped into different
categories.

1. On the Page Layout ribbon, in the Gridlines section, clear View.

This action hides the gridlines on the worksheet, removing some unnecessary clutter.

2. On the Insert ribbon, in the Charts section, click PivotChart, and then click PivotChart.

3. In the Create PivotChart dialog box, select Use this workbook's Data Model, and then click OK.
4. In the PivotChart Fields pane, expand Manufacturer, select Manufacturer, and drag it to the
LEGEND (SERIES) box.

5. In the PivotChart Fields pane, expand Products, expand More Fields, select Category, and drag it
to the AXIS (CATEGORIES) box.

6. In the PivotChart Fields pane, expand Sales, select Total Sales, and drag it to the VALUES box.

7. In the PivotChart Fields pane, expand Locations, select State, and drag it to the FILTERS box.

8. Move and resize the graph so that every manufacturer is visible in the legend.

Use the Chart to Examine Sales Data

1. On the chart, click the Manufacturer drop-down.

2. Clear (Select All), select Abbas, Barba, Natura, Pirum, and VanArsdel, and then click OK.

The data should be filtered and only display the value of sales for products made by these
manufacturers.

3. On the chart, click the Category drop-down.

4. Clear (Select All), select Mix, and Urban, and then click OK.

The data should be further filtered and only display the value of sales for products in the specified
categories made by these manufacturers.

5. On the chart, click the State drop-down.


7-4 Analyzing Data with Excel

6. Select NY, and then click OK.

The data is refined to show only the value of sales made in New York.

7. Leave the workbook open for the next demonstration.

Demonstration: Adding a Slicer to a PivotChart


Demonstration Steps
Create a Hierarchy for Country, State, and City in the Locations Table

1. In Excel, return to the worksheet from the previous demonstration.

Note: If you previously closed Excel without saving the workbook, you can find a copy
containing the chart from the previous demo in the file
D:\Demofiles\Mod07\VanArsdel_Sales_Demo2.xlsx.

2. On the Power Pivot ribbon, in the Data Model section, click Manage.

3. In the Power Pivot for Excel window, click Diagram View.


4. Scroll the window to bring the Locations table into view.

5. Click the Locations table, and then click the Create Hierarchy button.

6. In the Locations table, change the name of the Hierarchy1 field to Geography.

7. Click the Country field onto the Geography hierarchy.

8. Click the State field onto the Geography hierarchy, below Country.

9. Click the City field onto the Geography hierarchy, below State.
10. Scroll the window to bring the Products table into view. Note that this table already contains a
hierarchy comprising Category, Segment, and Product.

11. Close the Power Pivot for Excel window.

Add Slicers to the Sales Chart

1. On the Excel worksheet, click the column chart.

2. In the PivotChart Fields pane, remove the State field from the FILTERS box.

Note: If the PivotChart Fields pane is not visible, click the column chart, and on the
Analyze ribbon, click Field List.

3. In the fields list, scroll down to the Manufacturer field in the Manufacturer table, click the filter icon,
click Clear Filter From Manufacturer, and then click OK.

4. In the fields list, in the Products table, expand More Fields, click the filter icon by the Category field,
click Clear Filter From Category, and then click OK.

5. On the Excel worksheet, click the column chart again.


6. On the Analyze ribbon, click Field Buttons, and then click Hide All.

7. Click the worksheet outside of the chart.

8. On the Insert ribbon, in the Filters section, click Slicer.


Visualizing Data in Excel 7-5

9. In the Existing Connections dialog box, click the Data Model tab, and then click Open. This action
connects the slicer directly to the data model.

10. In the Insert Slicers dialog box, in the Locations table, select Geography, in the Manufacturer table
select Manufacturer, in the Products table select Product Hierarchy, and then click OK.

11. Arrange the chart and slicers so that the Country, State, and City slicers are on the left hand side
(you might need to move the chart to the right to make space), the Manufacturer slicer is on the
right of the chart, and the Category, Segment, and Product slicers are underneath.

12. Select all the slicers, right-click, click Slicer Settings, select Hide items with no data, and then click
OK.

13. Right-click the Country slicer and then click Report Connections. In the Report Connections dialog
box, select the Chart1 connection to associate the slicer with the chart, and then click OK.
Notice that this action also connects the State and City slicers to the report, as they are part of the
same hierarchy.

14. Right-click the Category slicer, and then click Report Connections. In the Report Connections
dialog box, select the Chart1 connection to associate the slicer with the chart, and then click OK.

This action also connects the Segment and Product slicers to the report.

15. Right-click the Manufacturer slicer and then click Report Connections. In the Report Connections
dialog box, select the Chart1 connection to associate the slicer with the chart, and then click OK.

Explore the Chart

1. Click the Clear Filter button on each slicer to remove any filters and cause the chart to display the
sales data of all products for all manufacturers in every country.

2. In the Country slicer, click USA.

Notice that the State slicer automatically clears all states that are not part of the USA, and the City
slicer clears all cities that are not located in states in the USA.

3. In the States slicer, select NJ and NY.

4. In the Category slicer, click Rural.


5. In the Manufacturer slicer, select Abbas, Natura, and Pirum.

The chart should now display the sales in New York and New Jersey for products in the Rural category
manufactured by Abbas, Natura, and Pirum.
6. Scroll through the City slicer.

Notice that the cities are organized by state, and all the cities for NJ and NY are selected. You can
select an individual city to see the data just for that city.

7. In the City slicer, click Borken.

Notice that the Country slicer automatically changes to Germany, and the State slicer switches to
Nordrhein-Westfalen. The chart now displays the sales for products in the Rural category made by
the specified manufacturers in this state.

8. In the Manufacturers slicer, click the Clear Filter button.

The graph now displays the data for products in the Rural category made by any manufacturer, but
only manufacturers with data are displayed.

9. In the Category slicer, click the Clear Filter button.

10. The graph should display the data for all products sold in Germany.
7-6 Analyzing Data with Excel

11. Leave the workbook open for the next demonstration.

Demonstration: Creating a Key Performance Indicator


Demonstration Steps
Create a KPI for the YTD Sales for Each Manufacturer

1. In Excel, return to the worksheet from the previous demonstration.

Note: If you previously closed Excel without saving the workbook, you can find a copy
containing the chart from the previous demo in the file
D:\Demofiles\Mod07\VanArsdel_Sales_Demo3.xlsx.

2. On the Power Pivot ribbon, in the Calculations section, click KPIs, and the click New KPI.
3. In the Key Performance Indicator (KPI) dialog box, in the KPI base field (value) drop-down, select
YTD Total Units.

4. In the Define target value section, click Absolute value, and type 10000.

5. In the slider section, set the first slider to 2000, set the second slider to 8000, and then click OK.

Add the KPI to the Dashboard

1. On the Excel worksheet, click cell O31 (just below the graph, and to the right of the Product slicer).
2. On the Insert menu, click PivotTable.

3. In the Create PivotTable, verify that the PivotTable will use the data model of the workbook, and
then click OK.
4. In the PivotTable Fields pane, expand Manufacturer, click Manufacturer, and then drag this field
to the ROWS box.

5. In the PivotTable Fields pane, expand Sales, expand the YTD Total Units KPI, select Status, and
then drag this field to the VALUES box. Click Value (YTD Total Units) and then drag this field to the
VALUES box, below the existing field for Status.

6. On the worksheet, click the Rows Labels cell in the header of the new PivotTable. On the Analyze
ribbon, in the Show section, clear Field Headers.

7. On the worksheet, click the cell containing the text YTD Total Units Status, and change the contents
of this cell to Status.

8. On the worksheet, right-click the cell containing the text Grand Total, and then click Remove Grand
Total.

Connect the Slicers to the KPI

1. Right-click the Country slicer, and then click Report Connections.

2. In the Report Connections dialog box, select the PivotTable2 connection, leave the Chart1
connection selected, and then click OK.

3. Right-click the Category slicer, and then click Report Connections.

4. In the Report Connections dialog box, select the PivotTable2 connection, leave the Chart1
connection selected, and then click OK.
5. Right-click the Manufacturer slicer, and then click Report Connections.
Visualizing Data in Excel 7-7

6. In the Report Connections dialog box, select the PivotTable2 connection, leave the Chart1
connection selected, and then click OK.

Explore the KPI

1. Click the Clear Filter button on each slicer to remove any filters and cause the chart to display the
sales data of all products for all manufacturers in every country.
Notice that the KPI indicators reflect the total units sold for products for each manufacturer across
every country.

2. In the Country slicer, click USA, and in the State slicer, click GA.

All of the KPI indicators should turn red as no manufacturer is responsible for 2,000 or more unit sales
yet.

3. In the State slicer, select the states NY through RI.

Some of the KPI indicators should turn yellow, and the indicator for VanArsdel should turn green.

4. Save the workbook in the D:\Demofiles\Mod07 folder and close Excel.


7-8 Analyzing Data with Excel

Lesson 2
Using Cube Functions
Contents:
Resources 9
Demonstration: Using Cube Functions in a Dashboard 9
Visualizing Data in Excel 7-9

Resources
What Is a Cube Function?

Best Practice: Many cube functions issue queries using the data model, and this can affect
responsiveness to the user if the queries need to retrieve data from the underlying data source.
However, by using a Power Pivot data model, you can mitigate this issue by ensuring that the
data required is cached on the Excel client.

Demonstration: Using Cube Functions in a Dashboard


Demonstration Steps
Lay Out the User Interface for the Dashboard

1. Start Excel 2016.

2. Open the workbook VanArsdel_Sales_Demo4.xlsx in the D:\Demofiles\Mod07 folder. This


workbook contains a copy of the same data model used in the previous demonstrations.

3. On the Sheet1 worksheet, click cell B2 and type the text Year.

4. Click cell C2 and change the name of this cell to Year. To change the name of a cell, in the Name
Box (which is situated on the left of the Function Bar), type Year, and then press Enter.

Best Practice: Use named cells and ranges when you are likely to be referring to them in
formulas.

5. Click cell B3 and type the text Measure.

6. Click cell C3 and change the name of this cell to Measure

7. Click cell B4 and type the text Sequence.

8. Click cell C4 and change the name of this cell to Sequence.

9. On the Insert menu, click Slicer.


10. In the Existing Connections dialog box, click the Data Model tab, and then click Open.

11. In the Insert Slicers dialog box, expand Products, expand More Fields, select Category, and then
click OK.
12. Move the Category slicer to cell C6.

13. In cell C2, type 2014.

14. In cell C3, type Total Sales.

Write Formulas to Retrieve the Data for the Dashboard

1. Add another worksheet, called Sheet2, to the workbook.

2. In cell A1, type the following formula:

="[Measures].["&Measure&"]"

This is an MDX expression that retrieves the measure named in the Measure cell on sheet Sheet1
from the data model.

3. Change the name of cell A1 to Measure_MDX.


7-10 Analyzing Data with Excel

4. In cell A2, type the following formula:

=CUBESET("ThisWorkbookDataModel", "[Calendar].[DateHierarchy].&["&Year&"].Children",
"Months")

This is another MDX expression that creates a set of all items in the Calendar cube with a year that
matches the month specified in the Year cell on Sheet1 from the data model. The worksheet should
display the text Months if the formula is correct.

5. Change the name of cell A2 to Months_MDX.

6. In cell A3, type the following formula:

=CUBEMEMBER("ThisWorkbookDataModel", "[Calendar].&["&Year&"]")

This MDX expression retrieves the item from the Calendar cube that matches the year specified on
Sheet1. The cell should display the text 2014.

Note: The value in cell A3 is a cube member and not text. This cube member contains the
details of all months and dates in the year, although only the year is displayed. You will retrieve
data from this member by using the CUBEVALUE function later in this demonstration.

7. Change the name of cell A3 to Year_MDX.

8. In cell A4, type the following formula:

=CUBESET("ThisWorkbookDataModel",
"[Manufacturer].[Manufacturer].Children","Manufacturers", Sequence, Measure_MDX)

This formula generates a set containing the sales that match the specified measure, broken down by
manufacturer. The data is sorted using the order specified in the Sequence cell on Sheet1. If the
formula is correct, it should display the text Manufacturers.

9. Change the name of cell A4 to Manufacturers_Set.

10. Add the following data to Sheet2:

Cell Value

A6 None

A7 Ascending

A8 Descending

B6 0

B7 1

B8 2

11. Change the name of the range A6:B8 to SortOrderTable.


12. Change the name of the range A6:A8 to SortOrderNames.

13. Return to Sheet1.

14. Click cell C4. This is the Sequence cell.


Visualizing Data in Excel 7-11

15. On the Data tab, click Data Validation.

16. In the Data Validation dialog box, in the Allow drop-down list box, select List. In the Source box,
type =SortOrderNames, and then click OK.

17. The Sequence cell should appear as a drop-down list box with the values None, Ascending, and
Descending. Select Ascending.
18. Return to Sheet2.

19. In cell A10, type the following formula:

=VLOOKUP(Sequence, SortOrderTable, 2)

The CUBESET function can sort data, but it uses numeric values to specify the sort order. This lookup
converts the order specified by the user into the corresponding value expected by CUBESET. The cell
should contain the value 1 to indicate that you selected Ascending on Sheet1.

20. Change the name of cell A10 to SortOrder.


Notice that cell A4 now displays the error message #VALUE! This is because the Sequence cell now
contains a text value rather than a number. Change the formula in cell A4 as highlighted below in
bold:

=CUBESET("ThisWorkbookDataModel",
"[Manufacturer].[Manufacturer].Children","Manufacturers", SortOrder, Measure_MDX)

Display the Data on the Dashboard

1. Return to Sheet1.
2. In cell G2, type the following formula:

=CUBERANKEDMEMBER("ThisWorkbookDataModel", Months_MDX, 1)

This formula retrieves the first item from the cube set defined by the Months_MDX cell. It should
display the text January. You can copy this formula across to the adjacent 11 cells, and change the
value of 1 to 2, 3, 4, and so on, to retrieve the appropriate months, but there is a better solution.

3. As in G2, change the formula as shown in bold below:

=CUBERANKEDMEMBER("ThisWorkbookDataModel", Months_MDX, COLUMN(A1))

4. The COLUMN function returns the column number of a given cell. In this case, COLUMN(A1) returns
the value 1.

5. Copy and paste the formula in cell G2 to cells H2 to R2.

Notice that the correct month names appear automatically. This is because in cell H2 the relative
reference to A1 in the COLUMN function is changed to B1. The value of the expression
COLUMN(B1) is 2 (column B is column 2). The same logic applies to the rest of the cells.

6. In cell T2, type the following formula:

=Year

This formula copies the year specified by the user. It will be used as a column heading for totals.
7-12 Analyzing Data with Excel

7. In cell F4, type the following formula:

=CUBERANKEDMEMBER("ThisWorkbookDataModel", Manufacturers_Set, ROW(A1))

The text Salvus should appear. This is the manufacturer with products responsible for the fewest sales
(the set is in ascending order). Note that the formula uses the ROW function rather than specifying
the value 1. This is for the same reason as using the COLUMN function earlier. When you copy and
paste this formula, it will automatically generate the appropriate values.

8. Copy the formula in cell F4 into cells F5 to F8.

You should now see the next four ranked members of the Manufacturers set.

9. In cell G4, type the following formula:

=CUBEVALUE("ThisWorkbookDataModel", Measure_MDX, $F4, G$2, Slicer_Category)

This formula calculates the value of Measure_MDX (YTD Sales) for the company in cell F4 (Salvus),
for the month in cell G2 (January 2014).

Note the use of the absolute reference to column F containing the company name, and row 2
containing the month names. You don't want these column or row references to change when you
copy and paste the formula.

10. Copy and paste the formula in cell G4 to the range G4:R8. Adjust the width of the cells so that the
values are all visible.

You should now see the month-by-month YTD sales for 2014 for the five bottom ranked companies.

11. In cell T4, enter the following formula:

=CUBEVALUE("ThisWorkbookDataModel", Measure_MDX, $F4, Year_MDX, Slicer_Category)

This formula calculates the total across the entire year; it references the year in the Year_MDX cell
rather than the individual months.

12. Click cell S4.


13. On the Insert ribbon, in the Sparklines section, click Line.

14. In the Create Sparklines dialog box, in the Data Range dialog box, enter G4:R4, and then click OK.

A graphical representation showing the trend in month-by-month sales should appear in cell S4.

15. Copy and paste the sparkline in cell S4 to cells S5 to S8.

Note: This layout, with a column displaying sparklines between the body of the data and
the totals column, is not possible with a PivotTable.

Explore the Dashboard

1. In cell C4, change the value to Descending.

The dashboard should now display the sales for the top five ranked companies.

2. In the slicer, click Urban.

The data in the dashboard should be filtered by the Urban category.

Experiment with different years, sequences, categories, and measures. You can use any of the
measures defined in the data model. If you add new measures to the data model, you can also use
them.
Visualizing Data in Excel 7-13

Note that the ranking is for the entire year across all categories.

3. Save the worksheet and close Excel.


7-14 Analyzing Data with Excel

Lesson 3
Creating Charts for Cube Functions
Contents:
Demonstration: Creating a Treemap Chart 15
Demonstration: Creating a Sunburst Chart 16
Demonstration: Creating a Histogram Chart 17
Visualizing Data in Excel 7-15

Demonstration: Creating a Treemap Chart


Demonstration Steps
Retrieve the Data for the Treemap Chart

1. Start Excel 2016.

2. Open the workbook VanArsdel_Sales_Demo5.xlsx in the D:\Demofiles\Mod07 folder. This


workbook contains a copy of the data model used in the previous demonstrations.

3. If the Security Warning message appears, click Enable Content.

4. On Sheet1, click cell B2.

5. On the Insert ribbon, click PivotTable.

6. In the Create PivotTable dialog box, select Use this workbook's Data Model, and then click OK.
7. In the PivotTable Fields pane, expand Locations, select Country, and then select State. Verify that
both fields appear in the ROWS box, with Country above State.

8. In the PivotTable Fields pane, expand Sales, select Total Sales, and drag it to the VALUES box.

9. On the worksheet, click anywhere in the PivotTable.

10. On the Insert ribbon, in the Filters section, click Timeline.

11. In the Insert Timelines dialog box, click the ALL tab, expand Calendar, expand More Fields, select
Date, and then click OK.

12. Move the timeline to cell F2, so that it does not overlap the PivotTable.

13. Select a date range in the timeline, and verify that the data shown in the PivotTable changes; it
should show the total sales for the specified range.

Convert the PivotTable to Formulas

1. On the worksheet, click anywhere in the PivotTable.

2. On the Design ribbon, in the Layout section, in the Report Layout menu, click Show in Tabular
Form.

3. On the Design ribbon, in the Layout section, in the Report Layout menu, click Repeat All Item
Labels.

4. On the Design ribbon, in the Layout section, in the Subtotals menu, click Do Not Show Subtotals.

5. On the worksheet, scroll to the grand total row (row 63), right-click the Grand Total label, and then
click Remove Grand Total.

6. Verify that the data in the PivotTable is sorted by country, and that no label or value filters are active
(all countries are expanded to show the states).

7. Click anywhere in the PivotTable.

8. On the Analyze ribbon, in the Calculations section, on the OLAP Tools menu, click Convert to
Formulas.

Note: After converting to formulas, the buttons that enable you to filter data in each
column will have disappeared. However, the timeline should still operate as it did before.
7-16 Analyzing Data with Excel

Create the Treemap Chart

1. On the worksheet, click any cell in the data.

2. On the Insert ribbon, in the Charts section, click Recommended Charts.

3. In the Insert Chart, dialog box, click the All Charts tab, click Treemap, and then click OK.

4. Move the chart so that it is directly below the timeline, and resize it to make the labels visible.
5. Change the chart title to Relative Sales by Country and State.

6. Explore the graph, and select different date ranges in the timeline to see how the relative sales in
each country and state vary over time.

Note: You can hover over a block to see the absolute value that the block represents.

7. Close the workbook, saving any changes.

Demonstration: Creating a Sunburst Chart


Demonstration Steps
Retrieve the Data for the Sunburst Chart

1. In Excel, open the workbook VanArsdel_Sales_Demo6.xlsx in the D:\Demofiles\Mod07 folder. This


workbook contains a copy of the data model used in the previous demonstrations.
2. Add a new worksheet to the workbook.

3. On the newly created worksheet, click cell B2.

4. On the Insert ribbon, click PivotTable.

5. In the Create PivotTable dialog box, select Use this workbook's Data Model, and then click OK.

6. In the PivotTable Fields pane, expand Calendar, expand More Fields, select Year, select Quarter,
and then select Month. Drag all three fields to the ROWS box, with Year at the top, followed by
Quarter, and then Month.

7. In the PivotTable Fields pane, expand Sales, select Total Units, and drag it to the VALUES box.

8. On the worksheet, click anywhere in the PivotTable.

9. On the Insert ribbon, in the Filters section, click Slicer.

10. In the Insert Slicers dialog box, click the ALL tab. Expand Locations, and then select Country.
Expand Manufacturer, and then select Manufacturer. Expand Products, expand More Fields, and
then select Category. Click OK.

11. On the worksheet, move the Country slicer to cell G2, move the Manufacturer slicer to cell L2, and
move the Category slicer to cell O2.

12. Using the slicers, verify that the data shown in the PivotTable changes; it should show the total units
sold for the specified combination of country, manufacturer, and category.

Convert the PivotTable to Formulas

1. On the worksheet, click anywhere in the PivotTable.

2. On the Design ribbon, in the Layout section, in the Report Layout menu, click Show in Tabular
Form.
Visualizing Data in Excel 7-17

3. On the Design ribbon, in the Layout section, in the Report Layout menu, click Repeat All Item
Labels.

4. On the Design ribbon, in the Layout section, in the Subtotals menu, click Do Not Show Subtotals.

5. On the worksheet, scroll to the grand total row (row 33), right-click the Grand Total label, and then
click Remove Grand Total.
6. Verify that the data in the PivotTable is sorted by year, and that no label or value filters are active.

7. Click anywhere in the PivotTable.

8. On the Analyze ribbon, in the Calculations section, on the OLAP Tools menu, click Convert to
Formulas.

Create the Sunburst Chart

1. On the worksheet, click any cell in the data.


2. On the Insert ribbon, in the Charts section, click Recommended Charts.

3. In the Insert Chart dialog box, click the All Charts tab, click Sunburst, and then click OK.

4. Move the chart so that it is directly below the slicers, and resize it to make the labels visible.

5. Change the chart title to Units Sold by Date.

6. Explore the graph, and select different combinations in the slicers to visualize the data.

Note: You can hover over a month segment in the chart to see the number of units sold for
that month.

7. Save the workbook, but leave it open for the next demonstration.

Demonstration: Creating a Histogram Chart


Demonstration Steps
Retrieve the Data for the Histogram Chart
1. In Excel, return to the worksheet from the previous demonstration.

Note: If you previously closed Excel without saving the workbook, you can find a copy
containing the chart from the previous demo in the file
D:\Demofiles\Mod07\VanArsdel_Sales_Demo7.xlsx.

2. Add a new worksheet to the workbook.

3. On the newly created worksheet, click cell B2.

4. On the Insert ribbon, click PivotTable.

5. In the Create PivotTable dialog box, select Use this workbook's Data Model, and then click OK.

6. In the PivotTable Fields pane, expand Manufacturer, select Manufacturer, and drag it to the
ROWS box.

7. In the PivotTable Fields pane, expand Sales, select Total Units, and drag it to the VALUES box.

8. On the worksheet, click anywhere in the PivotTable.

9. On the Insert ribbon, in the Filters section, click Slicer.


7-18 Analyzing Data with Excel

10. In the Insert Slicers dialog box, click the ALL tab. Expand Locations, and then select Country.
Expand Products, expand More Fields, and then select Category. Click OK.

11. On the worksheet, move the Country slicer to cell F2, and move the Category slicer to cell J2.

12. Using the slicers, verify that the data shown in the PivotTable changes; it should show the total units
sold for the specified combination of country, manufacturer, and category.
Convert the PivotTable to Formulas

1. On the worksheet, click anywhere in the PivotTable.

2. On the Design ribbon, in the Layout section, in the Report Layout menu, click Show in Tabular
Form.

3. On the worksheet, scroll to the grand total row (row 17), right-click the Grand Total label, and then
click Remove Grand Total.

4. Verify that no label or value filters are active.

5. Click anywhere in the PivotTable.

6. On the Analyze ribbon, in the Calculations section, on the OLAP Tools menu, click Convert to
Formulas.

Create the Charts

1. On the worksheet, click any cell in the data.

2. On the Insert ribbon, in the Charts section, click Recommended Charts.

3. In the Insert Chart dialog box, click the All Charts tab, click Histogram, and then click OK.

4. Move the chart so that it is directly below the slicers.


5. Right-click the labels in the horizontal X-axis, and then click Format Axis.

6. In the Format Axis pane, click By Category.

7. Resize the chart to make the X-axis labels readable.

8. Change the chart title to Units Sold by Manufacturer.

9. On the worksheet, click any cell in the data.

10. On the Insert ribbon, in the Charts section, click Recommended Charts.

11. In the Insert Chart dialog box, click the All Charts tab, click Histogram, click Pareto, and then click
OK.

12. Move the chart so that it is directly below the Histogram chart, and resize it to be the same size.

13. Change the chart title to Comparative Sales by Manufacturer.

14. Explore the graph, and select different combinations in the slicers to visualize the data.

Note: You can hover over the bar in either chart to see the number of units sold by that
manufacturer.

15. Save the workbook, and close Excel.


Visualizing Data in Excel 7-19

Module Review and Takeaways


Question: What are two reasons for adding hierarchies in the Excel Data Model?

( ) To enable additional filtering capabilities.

( ) To make it easier for users to select and navigate common paths of data when creating reports and
PivotTables.

( ) To provide logical drill-down capabilities to your reports.

( ) To create additional relationships between the tables in the data model.

Answer:

( ) To enable additional filtering capabilities.

() To make it easier for users to select and navigate common paths of data when creating
reports and PivotTables.

() To provide logical drill-down capabilities to your reports.

( ) To create additional relationships between the tables in the data model.

Question: Which of the following two ways can you use to connect a slicer to an existing PivotTable?

( ) Click the PivotTable, and on the Analyze ribbon, select Options.

( ) Click the PivotTable, and on the Analyze ribbon, select Filter Connections.
( ) Click the Slicer, and then on the Options ribbon, select Report Connections.

( ) Click the Slicer, and then on the Options ribbon, select Slicer Settings.

Answer:
( ) Click the PivotTable, and on the Analyze ribbon, select Options.

() Click the PivotTable, and on the Analyze ribbon, select Filter Connections.

() Click the Slicer, and then on the Options ribbon, select Report Connections.

( ) Click the Slicer, and then on the Options ribbon, select Slicer Settings.

Question: When should you convert a PivotTable to formulas?

Answer: You might do this to gain flexibility in arranging the positioning of the cells to create a
"free-format" report.

Question: Which CUBE function returns an aggregated value from the cube?

( ) CUBEMEMBER

( ) CUBEVALUE

( ) CUBESET

( ) CUBECOUNT

Answer:

( ) CUBEMEMBER

() CUBEVALUE

( ) CUBESET

( ) CUBECOUNT
7-20 Analyzing Data with Excel

Question: Which chart type should you use to present data across a period of time (for example, sales by
months)?

( ) Line

( ) Treemap

( ) Pie
( ) Scatter

( ) Radar

Answer:

() Line

( ) Treemap

( ) Pie

( ) Scatter

( ) Radar
Visualizing Data in Excel 7-21

Lab Review Questions and Answers


Lab: Data Visualizations in Excel
Question and Answers
Exercise 1: Generate a Tabular Report for the Sales Data
Question: How many units in the Youth category manufactured by Abbas were sold in January 2013?

Answer: 53

Exercise 2: Generate a Tabular Report for the Sales Data


Question: How many units in the Rural category manufactured by VanArsdel were sold in May 2015?

Answer: 5

Exercise 3: Generate a Tabular Report for the Sales Data


Question: Which manufacturer's units sold the most in 2014? What proportion of the total units sold in
2014 does this represent?

Note: you will need to calculate these items from the data shown in the report.

Answer: VanArsdel accounted for the most units (138814), which represents 30 percent of the
total units sold.

Exercise 4: Create Part-to-Whole Charts for the Sales Data


Question: Which of Abbas, Barba, and Fama accounted for the most sales in August 2013?

Answer: Products manufactured by Abbas were the most popular, with 1047 units compared to
587 for Fama and 874 for Barba.

Exercise 5: Create Part-to-Whole Charts for the Sales Data


Question: Over the period from 2013 to the end of 2015, how do sales for products manufactured by
Pirum compare to those manufactured by Salvus? Is there a trend?

Answer: Over the three years as a whole, Pirum products outsold those manufactured by Salvus
by 132595 to 10055. This is a ratio in excess of over 13:1. In 2013, the total sales were 44431 to
4477 (9.9:1). In 2014, the total sales were 49593 to 3895 (12.7:1). In 2015, the total sales were
38571 to 1683 (22.9:1).

The sales for Salvus products appear to have fallen significantly compared to those of Pirum, and
the trend appears to be accelerating.

Exercise 6: Create Charts to Detect Sales Trends


Question: Which months show the best overall sales figures in each year?

Answer: April and May.

Exercise 7: Create Charts to Detect Sales Trends


Question: At what time of year do products manufactured by Natura regularly outsell those
manufactured by VanArsdel?

Answer: December.

Using Excel with Power BI 8-1

Module 8
Using Excel with Power BI
Contents:
Lesson 1: Power BI 2

Lesson 2: Using Excel As a Data Source in Power BI 4

Module Review and Takeaways 6


Lab Review Questions and Answers 7
8-2 Analyzing Data with Excel

Lesson 1
Power BI
Contents:
Demonstration: Using a Power BI Dashboard 3
Using Excel with Power BI 8-3

Demonstration: Using a Power BI Dashboard


Demonstration Steps
Use the Customer Profitability Sample to Demonstrate Power BI Capabilities

1. Ensure that the 20779A-MIA-BI virtual machine is running, and then log on to 20779A-MIA-BI as
Admin with the password Pa55w.rd.

2. Start Microsoft Edge.

3. In the Search or enter web address text box, type http://www.powerbi.com, and then press Enter.

4. At the top right of the page, click Sign In.

5. Sign in with the credentials of your Power BI account.

6. In the navigation on the left, click Get Data.


7. Click the Samples link at the bottom of the page.

8. Click Customer Profitability Sample.

9. Show the sample description to the students, and then click Connect.
10. When the operation is complete, in the navigation on the left, under Dashboards, click Customer
Profitability.

11. Show and describe the data in the dashboard to students.


12. Click the Gross Margin tile at the top left.

13. Use the slicer at the top left of the report to select different executives.

14. At the bottom of the report, click the Industry Margin Analysis tab.

15. In the navigation on the left, under Dashboards, click Customer Profitability.

16. In the Ask a question about your data text box, type What was Tina Lassila's revenue?, and then
press Enter.
17. Close Microsoft Edge.
8-4 Analyzing Data with Excel

Lesson 2
Using Excel As a Data Source in Power BI
Contents:
Demonstration: Uploading and Using an Excel Workbook in Power BI 5
Using Excel with Power BI 8-5

Demonstration: Uploading and Using an Excel Workbook in Power BI


Demonstration Steps
Upload an Excel Workbook to Power BI and Use PivotCharts from the Workbook

1. Ensure that the 20779A-MIA-BI virtual machine is running, and then log on to 20779A-MIA-BI as
Admin with the password Pa55w.rd.

2. Start Microsoft Edge.

3. In the Search or enter web address text box, type http://www.powerbi.com, and then press Enter.

4. At the top right of the page, click Sign In.

5. Sign in with the credentials of your Power BI account.

6. In the navigation on the left, click Get Data.


7. Under Files, click Get, and then click Local File.

8. In the Open dialog, browse to D:\AllFIles\DemoFiles\Mod08.

9. Click SalesAnalysis.xlsx, and then click Open.


10. Under Upload your Excel file to Power BI, click Upload. The upload may take several minutes.

11. If a file with this name already exists message appears, click Replace it.

12. When the upload is complete, under Reports, click SalesAnalysis.

13. On the Sheet 2 worksheet, click the PivotChart on the left, and then click Pin.

14. In the Pin to dashboard dialog, select New dashboard and then type Sales Analysis.

15. Click Pin.


16. Click the middle PivotChart, and then click Pin.

17. In the Pin to dashboard dialog, select Existing dashboard.

18. In the drop-down list, select Sales Analysis, and then click Pin.
8-6 Analyzing Data with Excel

Module Review and Takeaways


Question: You are trying to view a Power BI report in the mobile app on a Windows 10 phone. There is
no phone-optimized version of the report. How can you access it from your phone?

Answer: Turn the phone to the landscape orientation. The app will display the non-optimized
version of the report.
Using Excel with Power BI 8-7

Lab Review Questions and Answers


Lab: Creating a Power BI Dashboard with Excel
Question and Answers
Lab Review
Question: How many products were sold in California?

Answer: 122

Question: What advantage does the report you created in Power BI Desktop have over the PowerCharts
you pinned to the dashboard from the uploaded Excel file?

Answer: The Power BI Desktop report is interactive. For example, you can click on a state in each
tile and it will update the other tile. You can also use natural language to interrogate the data.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy