Vous êtes sur la page 1sur 257

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

10778A
Lab Instructions and Lab Answer Key:
Implementing Data Models and Reports
with Microsoft SQL Server 2012

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.
2012 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: 10778A


Part Number: X18-29140
Released: 5/2012

Lab Instructions: Introduction to Business Intelligence and Data Modeling

Module 1
Lab Instructions: Introduction to Business Intelligence and
Data Modeling
Contents:
Exercise 1: Exploring a Reporting Services Report

Exercise 2: Exploring a PowerPivot Workbook

Exercise 3: Exploring a Power View Report

Lab Instructions: Introduction to Business Intelligence and Data Modeling

Lab: Reporting and Analyzing Data

Exercise 1: Exploring a Reporting Services Report


Scenario
You want to explore the options for viewing reports in SQL Server 2012. To achieve this, you have installed
SQL Server Reporting Services and Analysis Services in SharePoint Integrated mode, and a developer has
created a Reporting Services report for you to explore.
The main tasks for this exercise are as follows:
1.

Prepare the lab environment.

2.

Publish and view a Reporting Services report.

Task 1: Prepare the lab environment

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab01\Starter
folder as Administrator.

Task 2: Publish and view a Reporting Services report

Start Internet Explorer and browse to the http://mia-sqlbi SharePoint site.

In the Libraries section of the Quick Launch pane, click Reports.

On the Documents tab of the ribbon, click New Document and then click Report Builder Report. If
prompted to install Report Builder, click Run and wait for the application to be downloaded and
installed.

Lab Instructions: Introduction to Business Intelligence and Data Modeling

In the Getting Started window, click Open. Then browse to the


D:\10778A\Labfiles\Lab01\Starter\AWReports folder and open the Sales_Report.rdl report.

Click the round button at the top left of the Report Builder window, and click Save As. Then click the
Recent Sites and Servers shortcut, double-click http://mia-sqlbi/, double-click Reports, and click
Save.

Close Report Builder, and in Internet Explorer, in the Libraries section of the Quick Launch area, click
Reports to refresh the view.

Click the Sales_Report report, and note that it shows a chart of sales for 2004, as shown here.

At the top of the report page, click the Next Page button and note that this page shows sales details
for January. Each subsequent page shows sales for the remaining months of the year.

In the Year parameter list, check 2001, uncheck 2004, and then click Apply. Note that the report
now shows sales for 2001.

On the Actions menu bar, click Export, and then click Excel. Then, when prompted, click Open to
open the report in Excel.

View the report in Excel, and then close Excel and Internet Explorer.

Results: After this exercise, you should have published and viewed a Reporting Services report.

Lab Instructions: Introduction to Business Intelligence and Data Modeling

Exercise 2: Exploring a PowerPivot Workbook


Scenario
To help you to continue your exploration of reporting and data analysis options, a BI developer has
created a PowerPivot workbook for you to review. You also intend to test PowerPivot Gallery by
uploading the workbook.
The main tasks for this exercise are as follows:
1.

Open and review a PowerPivot for Excel workbook.

2.

Upload a PowerPivot for Excel workbook to PowerPivot Gallery.

3.

Open a PowerPivot for Excel workbook from PowerPivot Gallery.

Task 1: Open and review a PowerPivot for Excel workbook

In the D:\10778A\Labfiles\Lab01\Starter folder, double-click AW Sales.xlsx.

Click the Reseller Sales tab. This worksheet contains a PivotTable table on the left that displays the
Sales Amount, Product Cost, and Total Profit measures, a PivotChart chart on the right entitled
Sales Amount by Category by Year, and two slicers named Country and Calendar Year at the top
of the worksheet. The worksheet should resemble the following image.

Lab Instructions: Introduction to Business Intelligence and Data Modeling

In the PivotTable table, expand Bikes. Note that the values in the Sales Amount, Product Cost, and
Total Profit columns update automatically to show the data for the Bikes category. Note that the
color-coded conditional formatting in the Total Profit column displays a different color for each of
the bike categories. The color that is displayed for a given category depends on the value in the Total
Profit column for that category.

Expand Mountain Bikes and review the data for the different products in the Mountain Bikes
subcategory.

Review the data in the Sales Amount by Category by Year PivotChart chart.

In the Country slicer, click United Kingdom. Note that the data in the PivotTable table and the
PivotChart chart updates to show only the sales figures for the United Kingdom.

In the Calendar Year slicer, click 2004. Note that the data in the PivotTable table and the PivotChart
chart updates to show only the sales figures for 2004.

In the Calendar Year slicer and the Country slicer, click the Clear Filter button.

Close the PowerPivot window, and then close Excel without saving any changes.

Task 2: Upload a PowerPivot for Excel workbook to PowerPivot Gallery

Start Internet Explorer and browse to the http://mia-sqlbi SharePoint site.

In the Libraries list, click PowerPivot Gallery.

Click the Documents tab, click the Upload Document drop-down menu, and then click Upload
Document.

In the PowerPivot Gallery Upload Document dialog box, click Browse.

In the File name box, navigate to the D:\10778A\Labfiles\Lab01\Starter\ folder, click AW Sales.xlsx,
and then click Open.

In the PowerPivot Gallery Upload Document dialog box, click OK. If the PowerPivot Gallery
AW Sales.xlsx dialog box appears, click Save.

Task 3: Open a PowerPivot for Excel workbook from PowerPivot Gallery

In the PowerPivot Gallery, click the large AW Sales icon.

Click the Reseller Sales tab, and then use the Calendar Year and Country slicers to modify the data
that is displayed in the PivotTable table and PivotChart charts.

Clear the Calendar Year and Country slicer filters.

In the breadcrumb trail at the top of the page, click PowerPivot Gallery to close the workbook.

Keep Internet Explorer open for the next exercise.

Results: After this exercise, you should have reviewed and uploaded a PowerPivot for Excel workbook.

Lab Instructions: Introduction to Business Intelligence and Data Modeling

Exercise 3: Exploring a Power View Report


Scenario
Business users can find it useful to visualize data interactively. To explore this technique, you will use the
tabular data model in the uploaded PowerPivot workbook to create a Power View report.
The main task for this exercise is as follows:

Open a Power View report and create a column chart.

Task 1: Open a Power View report and create a column chart

In the PowerPivot Gallery, to the right of AW Sales, click the Create Power View Report button (use
the tooltips for the buttons to find this).

In the fields pane, expand Reseller Sales, and then select Sales Amount.

On the Design tab, in the Visualizations gallery, click Column. Then, drag the lower-right corner of
the chart to enlarge it.

In the fields pane, expand Date, and then select Calendar Year.

In the fields pane, expand Product, and then select Category. Then, in the chart, in the Category
series, click Clothing. The chart highlights the figures for the Clothing category. Click Clothing again
to display the figures for every category.

In the fields pane, in Date, select Month. This displays multiple charts, one for each month of the
year. The chart should now resemble the following image.

Close Internet Explorer. In the Windows Internet Explorer dialog box, click Leave this page.

Results: After this exercise, you should have created a Power View report.

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Module 2
Lab Instructions: Implementing Reports with SQL Server
Reporting Services
Contents:
Lab 2A: Creating a Report with Report Designer
Exercise 1: Creating a Report

Exercise 2: Grouping and Aggregating Data

Lab 2B: Enhancing and Publishing a Report


Exercise 1: Adding a Chart to a Report

Exercise 2: Adding Parameters to a Report

12

Exercise 3: Publishing a Report

14

Optional Exercise: Using Data Bars and Sparklines

15

Optional Exercise: Using a Map

18

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Lab 2A: Creating a Report with Report Designer

Exercise 1: Creating a Report


Scenario
The sales manager at Adventure Works spends a large amount of time each month using Excel to query
the data warehouse in order to produce a sales report that shows monthly sales broken down by product
category, subcategory, and individual product. You have been asked to create a reporting solution that
provides the sales manager with an Excel workbook containing the information they need without the
need to manually query the data warehouse each month.
The main tasks for this exercise are as follows:
1.

Prepare the lab environment.

2.

Create a Report Server project.

3.

Add a report to the project.

4.

Explore and modify report properties.

5.

Format the report.

6.

Export the report to Microsoft Excel

Task 1: Prepare the lab environment

Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab02A\Starter
folder as Administrator.

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Task 2: Create a Report Server project

Start SQL Server Data Tools and create a new Report Server project named AWReports in the
D:\10778A\Labfiles\Lab02A\Starter\Ex1 folder.

Task 3: Add a report to the project

Use the Report Wizard to add a report to the project. Specify the following settings in the wizard:

Create a new embedded data source named AdventureWorksDW that connects to the
AdventureWorksDW database on the localhost instance of SQL Server by using Windows
authentication.

Use the following query to retrieve the data for the report (You can import this query from the
D:\10778A\Labfiles\Lab02A\Starter\Ex1\SalesQuery.sql).
SELECT d.CalendarYear [Year],
d.MonthNumberOfYear [MonthNo],
d.EnglishMonthName [Month],
c.EnglishProductCategoryName [ProductCategory],
s.EnglishProductSubcategoryName [ProductSubcategory],
p.EnglishProductName [Product],
i.SalesOrderNumber,
i.OrderDate,
i.SalesAmount
FROM dbo.DimProductCategory c
INNER JOIN dbo.DimProductSubcategory s ON s.ProductCategoryKey = c.ProductCategoryKey
INNER JOIN dbo.DimProduct p ON p.ProductSubcategoryKey = s.ProductSubcategoryKey
INNER JOIN dbo.FactInternetSales i ON i.ProductKey = p.ProductKey
INNER JOIN dbo.DimDate d ON i.OrderDateKey = d.DateKey
ORDER BY d.CalendarYear, d.MonthNumberOfYear, c.EnglishProductCategoryName,
s.EnglishProductSubcategoryName, p.EnglishProductName, i.SalesOrderNumber

Create a tabular report that includes the Year, Month, ProductCategory, ProductSubcategory,
Product, SalesOrderNumber, OrderDate, and SalesAmount fields in the details section with no
groupings.

Apply the generic report style.

Name the report Sales Report.

Task 4: Explore and modify report properties

In the Report Data pane, change the name of the Dataset1 dataset to Sales.

In the Groupings pane, change the name of the table1_Details_Group to SalesDetails.

Task 5: Format the report

Preview the report to view the default formatting.

On the Design tab, format the report so that when previewed it looks like the following image. Use
the following formatting techniques:

To format text, select the text or textbox in which it is displayed and use the formatting buttons
on the toolbar.

To change column widths, drag the edges of the column headers.

Lab Instructions: Implementing Reports with SQL Server Reporting Services

To apply a number or date format, right-click the textbox containing the data field and click
properties. Then on the Number tab, select an appropriate format.

Task 6: Export the report to Microsoft Excel

Preview the report and export it to a Microsoft Excel workbook named Sales Report.xlsx in the
D:\10778A\Labfiles\Lab02A\Starter\Ex1 folder.

Open the exported report in Excel and view it.

Close Excel and SQL Server Data Tools.

Results: After this exercise, you should have a report that shows sales data from the
AdventureWorksDW database.

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Exercise 2: Grouping and Aggregating Data


Scenario
The sales manager has reviewed the report you have created and requested that you modify it so that the
Excel workbook generated from the report includes a blank title worksheet and a worksheet for each
month of the year. On each months worksheet, sales for that month should be grouped by product
category, product subcategory, and individual product.
The main tasks for this exercise are as follows:
1.

Open the AWReports project.

2.

Delete the Year column and Titles row.

3.

Group the report by Month.

4.

Add groups for Product Category, Product Subcategory, and Product.

5.

Add aggregate summary values.

6.

Enable drilldown interactions.

7.

Add page breaks

Task 1: Open the AWReports project

Open the AWReports solution in the D:\10778A\Labfiles\Lab02A\Starter\Ex2 folder with SQL Server
Data Tools.

View the Sales Report report.

Task 2: Delete the Year column and titles row

Delete the Year column.

Delete the row containing the column titles.

Task 3: Group the report by Month

Add a parent group to the SalesDetails group. The new group should group the data on the Month
field and should include a group header.

Preview the report and note that the month is now displayed at the group level and in the detail
level.

Delete the column that displays the Month field in the details group. This column is no longer
required because the month is now displayed in the parent group header.

Preview the report again and note that the months are displayed in alphabetical order.

Edit the properties of the new parent group so that the group is sorted by the MonthNo field. This
ensures that the data is displayed in the correct month order (January, February, and so on.)

Preview the report again to ensure it looks correct.

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Task 4: Add groups for Product Category, Product Subcategory, and Product

Add parent groups with group headers to the SalesDetails group for the ProductCategory,
ProductSubcategory, and Product fields.

Delete the details columns for the fields in the report that now have their own groups.

Ensure your report looks like the following image.

Task 5: Add aggregate summary values

Add totals rows before the SalesDetails, Product, ProductSubcategory, and ProductCategory
groups.

Add the following expression in the Product group heading row immediately above the
SalesOrderNumber field:
=Count(Fields!SalesOrderNumber.Value)

Copy the cell containing the expression to the ProductSubcategory, ProductCategory, and Month
rows.

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Verify that your report looks like the following image.

Task 6: Enable drilldown interactions

Edit the visibility properties of the SalesDetails group so that it is hidden by default and its visibility
can be toggled by the Product1 textbox (which is the textbox containing the Product value in the
Product group heading.

Modify the Product group so that its visibility can be toggled by the ProductSubcategory1 textbox.

Modify the ProductSubcategory group so that its visibility can be toggled by the
ProductCategory1 textbox

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Verify that when previewed, your report provides drilldown functionality as shown in the following
image.

Task 7: Add page breaks

Set the InitialPageName property of the report to Sales Summary.

In the Groupings pane, select the Month group and then in the Properties pane, in the Group
section, create a page break between each instance of the group.

Set the PageName property for the Month group to the following expression:
=Fields!Month.Value

Add a page break at the start of the table1 Tablix object so that the table starts on a new page,
leaving a blank page with only the report title at the beginning of the report.

Preview the report and export it to a Microsoft Excel workbook named Sales Report.xlsx in the
D:\10778A\Labfiles\Lab02A\Starter\Ex2 folder.

Open the exported report in Excel and view it to verify that the first sheet in the workbook is named
Sales Summary, and that there is an additional sheet for each months sales. The worksheets for each
months sales should enable users to drilldown and view the data at the product category,
subcategory, and product levels.

Close Excel and SQL Server Data Tools.

Results: After this exercise, you should have a report that includes sales data grouped by month, product
category, subcategory, and product.

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Lab 2B: Enhancing and Publishing a Report

Exercise 1: Adding a Chart to a Report


Scenario
The sales manager at Adventure Works has requested that you add a chart to first page of the sales
report. The chart should show sales volumes for each product category across months of the year.
The main tasks for this exercise are as follows:
1.

Prepare the lab environment.

2.

Open the AWReports project.

3.

Add a Chart report item.

4.

Specify the data for the chart.

5.

Format the chart.

Task 1: Prepare the lab environment

Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab02B\Starter
folder as Administrator.

Task 2: Open the AWReports project

Open the AWReports solution in the D:\10778A\Labfiles\Lab02B\Starter\Ex1 folder with SQL Server
Data Tools.

View the Sales Report report.

10

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Task 3: Add a Chart report item

Move the existing tablix data region down to make room for the chart.

Add a chart to the report above the tablix data region. The chart should be a 3D clustered column
chart, and you should resize it to fit the space above the tablix data region.

Task 4: Specify the data for the chart

Configure the chart with the following data fields:

Values: SalesAmount

Category Groups: Month

Series: ProductCategory

Edit the properties of the Month field in the Category Groups section so that the group is sorted by
the MonthNo field.

Task 5: Format the chart

Edit the chart properties and change the Color palette property to Semi transparent.

Delete the chart title

Format the vertical axis so that the numbers are formatted as currency with a separator for thousands.

Preview the report and verify that the chart looks like this.

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Export the report to a Microsoft Excel workbook named Sales Report.xlsx in the
D:\10778A\Labfiles\Lab02A\Starter\Ex2 folder.

Open the chart in Excel and verify that the first worksheet includes the chart you created. Then close
SQL Server Data Tools and Excel.

Results: After this exercise, you should have a report that includes a chart.

11

12

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Exercise 2: Adding Parameters to a Report


Scenario
The report you have created for the sales manager currently shows sales grouped by month, but the data
is not filtered to any particular year. This means that the chart shows the total sales for each month
regardless of what year the sale occurred in. You must add a parameter to the report so that the sales
manager can filter the report to include the years they want to view, with a default value that ensures the
report only shows sales for the most recent sales year.
The main tasks for this exercise are as follows:
1.

Open the AWReports project.

2.

Add a parameter.

3.

Configure available and default values for a parameter.

Task 1: Open the AWReports project

Open the AWReports solution in the D:\10778A\Labfiles\Lab02B\Starter\Ex2 folder with SQL Server
Data Tools.

View the Sales Report report.

Task 2: Add a parameter

In the Report Data pane, edit the query for the Sales dataset so that it matches the following
Transact-SQL query. You can import this query from D:\10778A\Labfiles\Lab02B\Starter\Ex2\
Parameterized Sales Query.sql:
SELECT d.CalendarYear [Year],
d.MonthNumberOfYear [MonthNo],
d.EnglishMonthName [Month],
c.EnglishProductCategoryName [ProductCategory],
s.EnglishProductSubcategoryName [ProductSubcategory],
p.EnglishProductName [Product],
i.SalesOrderNumber,
i.OrderDate,
i.SalesAmount
FROM dbo.DimProductCategory c
INNER JOIN dbo.DimProductSubcategory s ON s.ProductCategoryKey = c.ProductCategoryKey
INNER JOIN dbo.DimProduct p ON p.ProductSubcategoryKey = s.ProductSubcategoryKey
INNER JOIN dbo.FactInternetSales i ON i.ProductKey = p.ProductKey
INNER JOIN dbo.DimDate d ON i.OrderDateKey = d.DateKey
WHERE d.CalendarYear IN (@Year)
ORDER BY d.CalendarYear, d.MonthNumberOfYear, c.EnglishProductCategoryName,
s.EnglishProductSubcategoryName, p.EnglishProductName, i.SalesOrderNumber

Edit the Year report parameter created when the dataset query was updated so that is has a data
type of Integer allows multiple values.

Edit the textbox containing the report title so that is contains the following expression:
="Sales Report for " & Join(Parameters!Year.Value, ", ")

Preview the report and verify that you can specify multiple year values in the parameter box by typing
2003, inserting a new line, and typing 2004. Click View Report to render the report with the
parameter values.

Lab Instructions: Implementing Reports with SQL Server Reporting Services

13

Task 3: Configure available and default values for a parameter

In the Report Data pane, add a dataset named SalesYears. The data set should be embedded in the
report and use the following query (which you can import from
D:\10778A\Labfiles\Lab02B\Starter\Ex2\Sales Years.sql):
SELECT DISTINCT YEAR(OrderDate) [Year]
FROM FactInternetSales
ORDER BY YEAR(OrderDate) DESC

Add another embedded dataset named MaxYear that uses the following query (which you can
import from D:\10778A\Labfiles\Lab02B\Starter\Ex2\Max Years.sql):
SELECT YEAR(MAX(OrderDate)) [MaxYear]
FROM FactInternetSales

Edit the properties of the Year report parameter to get the available values from the SalesYears
dataset and the default value from the MaxYear dataset.

Preview the report and verify that the default parameter is used to render the report for the current
year, and that you can select one or more years from the available values in the Year parameter
drop-down list.

Close SQL Server Data Tools.

Results: After this exercise, you should have a report that includes a parameter with default and available
values based on datasets that retrieve data from a database.

14

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Exercise 3: Publishing a Report


Scenario
You have created a report for the sales manager, and must now deploy it to the report server, which is
installed in SharePoint Integrated mode.
The main tasks for this exercise are as follows:
1.

Open the AWReports project.

2.

Configure deployment properties.

3.

Deploy the AWReports project.

Task 1: Open the AWReports project

Open the AWReports solution in the D:\10778A\Labfiles\Lab02B\Starter\Ex3 folder with SQL Server
Data Tools.

View the Sales Report report.

Task 2: Configure deployment properties

Set the following properties for the AWReports project:

OverwriteDatasets: True

OverwriteDataSources: True

TargetDatasetFolder: http://mia-sqlbi/Reports/Datasets

TargetDataSourceFolder: http://mia-sqlbi/Reports/Data Sources

TargetReportFolder: http://mia-sqlbi/Reports

TargetReportPartFolder: http://mia-sqlbi/Reports/Report Parts

TargetServerURL: http://mia-sqlbi

TargetServerVersion: SQL Server 2008 R2 or later

Task 3: Deploy the AWReports project

Deploy the project, and monitor the deployment status in the Output window.

When the project has been successfully deployed, close SQL Server Data Tools and use Internet
Explorer to browse to the SharePoint site at http://mia-sqlbi.

In the Quick Launch area, under Libraries, click Reports.

In the Reports library, click Sales Report and note that the report is displayed with the default
parameter value.

Export the report to a Microsoft Excel workbook named Sales Report.xlsx in the
D:\10778A\Labfiles\Lab02A\Starter\Ex2 folder.

Open the chart in Excel and verify that the first worksheet includes the chart you created. Then close
Internet Explorer and Excel.

Results: After this exercise, you should have configured and deployed a Report Server project.

Lab Instructions: Implementing Reports with SQL Server Reporting Services

15

Optional Exercise: Using Data Bars and Sparklines


Scenario
The sales manager wants to be able to easily compare sales by product category. You must create a report
that shows a visual comparison of total sales for the year and a comparison that shows the trend for sales
of each category across the year.
The main tasks for this exercise are as follows:
1.

Open the AWReports project.

2.

Add a data bar.

3.

Add a spark line.

Task 1: Open the AWReports project

Open the AWReports solution in the D:\10778A\Labfiles\Lab02B\Starter\Opt1 folder with SQL Server
Data Tools.

View the Sales Trends report.

Task 2: Add a data bar

Modify the report to include a Sales Volume: label and a data bar as shown here,

You will need to add the SalesAmount field to the Values section in the Chart Data pane.

Configure the series properties of the SalesAmount field to use the following fill options.

Fill style: Gradient

Color: Light Steel Blue

Secondary color: Cornflower Blue

Gradient Style: Left right

16

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Configure the horizontal axis properties of the SalesAmount field so that the axes are aligned at the
table1 scope.

Ensure that the data bar does not have a border.

When you preview the report, it should show a data bar that indicates the relative sales volume for
each product category, as shown here.

Task 3: Add a sparkline

Modify the report to include a Monthly Trend: label and a sparkline as shown here.

Add the SalesAmount field to the Values area of the Chart Data window for the sparkline, and
select the MonthNumberOfYear field in the Category Groups section.

Configure the series properties of the SalesAmount field to use the following fill options.

Fill style: Gradient

Color: Light Steel Blue

Secondary color: Cornflower Blue

Gradient Style: Top bottom

Configure both the horizontal axis and the vertical axis so that they are aligned at the table1 scope.

Ensure that the data bar does not have a border.

Lab Instructions: Implementing Reports with SQL Server Reporting Services

17

When you preview the report, it should show a sparkline that shows the sales trend for each category
across the year, as shown here.

Results: After this exercise, you should have created a report that uses a data bar and a sparkline to show
a visual comparison of sales by product category.

18

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Optional Exercise: Using a Map


Scenario
You have created a report that lists sales totals for each US state. The sales manager has requested that
the report show these sales values visually on a map.
The main tasks for this exercise are as follows:
1.

Open the AWReports project.

2.

Add a map.

3.

Format the map.

Task 1: Open the AWReports project

Open the AWReports solution in the D:\10778A\Labfiles\Lab02B\Starter\Opt2 folder with SQL Server
Data Tools.

View the US Sales By State report.

Task 2: Add a map

Drag a Map item from the toolbox to the report body and complete the New Map Layer wizard
using the following settings:

On the Choose a source of spatial data, ensure Map gallery is selected and in the Map Gallery
pane, select USA by State Insert. Then click Next.

On the Choose spatial data and map view options page, review the default settings and click
Next.

On the Choose map visualization page, select Color Analytical Map and click Next.

On the Choose the analytical dataset page, select Sales and click Next.

On the Specify the match fields for spatial and analytical data page, select the checkbox for
the STATENAME field, and in the Analytical Data Fields column, select StateProvinceName.
Then click Next.

On the Choose color theme and data visualization page, in the Theme drop-down list, select
Ocean; in the Field to visualize drop-down list, select [Sum(SalesTotal)]; and in the Color rule
drop-down list, select White-Blue. Then click Finish.

Lab Instructions: Implementing Reports with SQL Server Reporting Services

Task 3: Format the map

Click the map to display the Map Layers pane (you might need to scroll to the right to see the Map
Layers pane as shown here), and modify the properties of the map as described below.

Set the polygon properties of the PolygonLayer1 layer so that [Sum(SalesTotal)] is displayed as a
tooltip.

Set the polygon color rule of the PolygonLayer1 layer so that the color of each state is displayed
with the following distribution.

Number of subranges: 10

Range start: 0

Modify the properties of the legend above the color distribution legend at the top right to change
the title text to Sales ($).

Change the map title to Sales by State.

Remove the color scale at the bottom left.

19

20

Lab Instructions: Implementing Reports with SQL Server Reporting Services

When you preview the report, the map should indicates sales volume in each state by the shade of
the color used to fill the state and display tooltips for each state that show the actual sales amount as
shown in the following image.

Results: After this exercise, you should have created a report that shows sales by US state on a map.

Lab Instruction: Supporting Self Service Reporting

Module 3
Lab Instructions: Supporting Self Service Reporting
Contents:
Exercise 1: Using Report Builder

Exercise 2: Simplifying Data Access for Business Users

Exercise 3: Using Report Parts

Lab Instruction: Supporting Self Service Reporting

Lab: Implementing Self Service Reporting

Exercise 1: Using Report Builder


Scenario
You intend to provide a self-service reporting solution at Adventure Works Cycles so that business users
can create their own reports. Report Builder will be the primary authoring tool for business users, so you
want to use it to create a report in order to understand the authoring experience it will provide to your
business users.
The main tasks for this exercise are as follows:
1.

Prepare the lab environment.

2.

Install Report Builder.

3.

Create a report.

4.

Format the report.

5.

Publish the report.

Task 1: Prepare the lab environment

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab03\Starter
folder as Administrator.

Lab Instruction: Supporting Self Service Reporting

Task 2: Install Report Builder

Start Internet Explorer and browse to the SharePoint site at http://mia-sqlbi.

In the Reports document library, on the Documents tab of the ribbon, in the New Document dropdown list, click Report Builder Report. Then install Report Builder and wait for it to start.

Task 3: Create a report

Use Report Builder to create a new report with the Table or Matrix Wizard. Use the following settings
when creating your report:

Create a dataset for the report and add a new SQL Server data source named
AdventureWorksDW that uses the following connection string:
Data source=localhost;Initial Catalog=AdventureWorksDW

Use the query designer to create a query that retrieves the following fields, verifying the
relationships that are detected by the query designer.
DimProductCategory.EnglishProductCategoryName
DimProductSubcategory.ProductCategoryKey
DimProduct.ProductSubcategoryKey
DimGeography.EnglishCountryRegionName
DimGeography.StateProvinceName
DimGeography.City
DimReseller.GeographyKey
FactResellerSales.ResellerKey
FactResellerSales.SalesAmount

Arrange the fields in the report as follows:


Row groups
EnglishCountryRegionName
StateProvinceName
City
Column groups
EnglishProductCategoryName
Values
SalesAmount

Show subtotals and grand totals, lay out the report as blocked with subtotals below details rows,
and enable expand and collapse interactions with groups.

Format the report using the Generic style.

Lab Instruction: Supporting Self Service Reporting

Task 4: Format the report

Change the report title to Reseller Sales by Product Category.

Apply formatting to the report to align data in columns, make titles bold, format currency values
appropriately, and generally improve the visual design of the report.

Click Run to preview the report, and continue formatting the report until you are satisfied with it.

Task 5: Publish the report

Save the report as Reseller Sales by Product Category.rdl in the http://mia-sqlbi/Reports folder.
Then close Report Builder.

In Internet Explorer, refresh the view of the Reports document library and view the report in the
browser.

Results: After this exercise, you should have used Report Builder to create and publish a report.

Lab Instruction: Supporting Self Service Reporting

Exercise 2: Simplifying Data Access for Business Users


Scenario
You have used Report Builder to create a report, and you are concerned that some business users will find
it difficult to create data sources and datasets when authoring their own reports. To help these users, you
want to create a shared data source for the data warehouse and shared datasets for commonly requested
reporting data so that business users do not need to learn how to define connection strings or TransactSQL queries when creating reports.
The main tasks for this exercise are as follows:
1.

Create a shared data source.

2.

Create shared datasets.

3.

Create a report from shared data items.

Task 1: Create a shared data source

In Internet Explorer, in the Reports document library, on the Documents tab of the ribbon, in the
New Document drop-down list, click Report Data Source. Then add a new data source with the
following settings:

Name: Adventure Works Data Warehouse

Data Source Type: Microsoft SQL Server

Connection string: Data source=localhost;Initial Catalog=AdventureWorksDW

Credentials: Windows authentication (integrated) or SharePoint user

Availability: Enable this data source selected

Task 2: Create shared datasets

In the Reports document library, on the Documents tab of the ribbon, in the New Document dropdown list, click Report Builder Report to start Report Builder.

Use Report Builder to create a new dataset based on the shared data source you created in the
previous task. Use the following settings when creating the dataset:

Import the Reseller Sales By Year.sql query file from the D:\10778A\Labfiles\Lab03\Starter
folder.

Set the parameter options for the dataset so that the @CalendarYear parameter is an integer
data type and allows multiple values.

Save the dataset as Reseller Sales by Year.rsd in the http://mia-sqlbi/Reports folder.

Create a second shared dataset that uses the Reseller Years.sql query file in the
D:\10778A\Labfiles\Lab03\Starter folder, and save it as Reseller Years.rsd in the
http://mia-sqlbi/Reports folder.

Create a third shared dataset that uses the Most Recent Reseller Year.sql query file in the
D:\10778A\Labfiles\Lab03\Starter folder, and save it as Most Recent Reseller Year.rsd in the
http://mia-sqlbi/Reports folder.

Lab Instruction: Supporting Self Service Reporting

Task 3: Create a report from shared data items

Use Report Builder to create a new report with the Table or Matrix Wizard. Use the following settings
when creating your report:

Use the Reseller Sales by Year.rsd dataset.

Arrange the fields in the report as follows:


Row groups
CalendarYear
Month
Column groups
ProductCategory
Values
SalesAmount

Show subtotals and grand totals, lay out the report as blocked with subtotals below details rows,
and enable expand and collapse interactions with groups.

Format the report using the Generic style.

Add a dataset named Years based on the Reseller Years.rsd shared dataset to the report.

Add a dataset named MostRecentYear based on the Most Recent Reseller Year.rsd shared dataset
to the report.

Configure the CalendarYear report parameter to get its available values from the CalendarYear field
in the Years dataset, and its default value from the CalendarYear field in the MostRecentYear
dataset.

Change the report title to Reseller Sales by Year and format the report as you think appropriate.

Modify the Month group properties so that the data in the group is sorted by the MonthNo column.

Preview the report and verify that the default and available parameter values can be used to filter the
report.

Save the report as Reseller Sales by Year.rdl in the http://mia-sqlbi/Reports folder.

Results: After this exercise, you should have a shared data source, three shared datasets, and a report that
is based on the shared data items.

Lab Instruction: Supporting Self Service Reporting

Exercise 3: Using Report Parts


Scenario
You have identified a chart that business users frequently request in reports. You want to publish the chart
as a report part to enable users to include it in their own reports.
The main tasks for this exercise are as follows:
1.

Create a report part.

2.

Use a report part.

Task 1: Create a report part

In Report Builder, create a new report by using the Chart Wizard. Use the following settings when
creating the report:

Create a new dataset based on the Adventure Works Data Warehouse.rsds shared data source.
The data source should use the query defined in the Count Resellers by Country.sql query file,
which is in the D:\10778A\Labfiles\Lab03\Starter folder.

Create a pie chart that shows resellers as values and the countries as categories.

Format the chart using the Generic style.

When the report is created, change the chart title to Resellers by Country and resize the chart to
make it bigger.

Change the Name property of the chart to ResellersChart and change the Name property of the
dataset that was created by the wizard to ResellersByCountry.

On the Report Builder menu (which is opened by clicking the round button at the top left of the
ribbon), click Publish Report Parts. Then select the Reports document library and select the option
to review and modify the report parts before publishing.

Add the description Chart showing the number of resellers in each country to the ResellersChart
report part and then publish the report part.

Task 2: Use a report part

In Report Builder, create a new blank report. Do not save the current report (from which you
published the ResellerChart report part)

With the new blank report open in Report Builder, view the Report Part Gallery pane and search for
Resellers. This should find the ResellerChart report part.

Add the ResellerChart report part to the report, and then modify the properties of the chart to use
the Semi transparent color palette.

Change the report title to Resellers By Country - Pie Chart and save it as Resellers By Country Pie Chart.rdl in the http://mia-sqlbi/Reports folder.

Create another blank report and add the ResellerChart report part to it. Then change the chart type
to a column chart, change the report title to Resellers By Country - Column Chart and save it as
Resellers By Country - Column Chart.rdl in the http://mia-sqlbi/Reports folder.

Results: After this exercise, you should have a report part that is used in two reports.

Lab Instructions: Managing Report Execution and Delivery

Module 4
Lab Instructions: Managing Report Execution and Delivery
Contents:
Exercise 1: Configuring Report Execution

Exercise 2: Implementing a Standard Subscription

Exercise 3: Implementing a Data-Driven Subscription

Lab Instructions: Managing Report Execution and Delivery

Lab: Configuring Report Execution and Delivery

Exercise 1: Configuring Report Execution


Scenario
You have developed a reporting solution for Adventure Works Cycles. The solution includes a report that
is used to view sales for each product category by month. As the year progresses, the sales report can
include a large volume of data and be unacceptably slow to render. Business users can accept a latency of
one day when viewing report, and so you have decided to improve rendering performance by caching the
report and refreshing the cached instance at midnight each day.
The main tasks for this exercise are as follows:
1.

Prepare the lab environment.

2.

Deploy reports.

3.

Configure a shared data source.

4.

Configure a report.

Task 1: Prepare the lab environment

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab04\Starter
folder as Administrator.

Task 2: Deploy reports

Open the AWReports.sln solution in the D:\10778A\Labfiles\Lab04\Starter folder with SQL Server Data
Tools.

Review the contents and deployment properties of the project, and then deploy it.

Lab Instructions: Managing Report Execution and Delivery

Task 3: Configure a shared data source

In the Reports document library in the http://mia-sqlbi SharePoint site, view the dependent items of
the AdventureWorksDW data source and confirm that this data source is used by the Monthly
Sales Report report.

Edit the data source definition for the AdventureWorksDW data source and configure it to use the
following stored Windows credentials:

User Name: ADVENTUREWORKS\ServiceAcct

Password: Pa$$w0rd

Task 4: Configure a report

In the Reports document library in the http://mia-sqlbi SharePoint site, manage the processing
options for the Monthly Sales Report report, and configure it to use cached data. The cached report
should expire on a custom schedule at midnight every day.

View the report and note the execution time. Then wait a few minutes and view the report again,
verifying that the execution time has not changed since the previous view because a cached instance
is rendered.

Results: After this exercise, you should have configured a shared data source to use stored credentials,
and configured a report to display a cached instance.

Lab Instructions: Managing Report Execution and Delivery

Exercise 2: Implementing a Standard Subscription


Scenario
The senior sales executive at Adventure Works wants to receive the sales report in Microsoft Excel format
by email. To accomplish this, you intend to have the executive create a subscription, and you want to test
the functionality before providing instructions to the executive.
The main tasks for this exercise are as follows:
1.

Subscribe to a report.

2.

Verify the subscription.

Task 1: Subscribe to a report

In the Reports document library in the http://mia-sqlbi SharePoint site, view the Monthly Sales
Report report.

On the Actions menu, click Subscribe and create a subscription with the following settings:

Delivery Extension: E-Mail

To: student@adventureworks.msft

Comment: The sales report is attached

Show report inside message: Selected

Format: Excel

Delivery Event: On a custom schedule in two minutes from the current time (You can determine
the current system time by starting a command prompt window and entering the command
time /T)

Parameters: Use report default value

Task 2: Verify the subscription

In the Reports document library in the http://mia-sqlbi SharePoint site, in the drop-down list for the
Monthly Sales Report report, click Manage Subscriptions.

View the information about the subscription you created in the previous task. Then wait for two
minutes and refresh the page until the Last Results column indicates that mail was sent to
student@adventureworks.msft.

View the contents of the C:\inetpub\mailroot\Drop folder and verify that an email message was sent.

Open the email message and verify that it contains the report in Microsoft Excel format.

Results: After this exercise, you should have created a standard subscription that delivers a report by
email.

Lab Instructions: Managing Report Execution and Delivery

Exercise 3: Implementing a Data-Driven Subscription


Scenario
A number of business users want to receive the sales report by email. However, the users have expressed a
preference for a variety of formats and subscription options. You have decided to use a data-driven
subscription to deliver the report to these users.
The main tasks for this exercise are as follows:
1.

Create a table of subscription data.

2.

Create a data-driven subscription.

3.

Verify the subscription.

Task 1: Create a table of subscription data

Use SQL Server Management Studio to open the Subscription Table.sql script file in the
D:\10778A\Labfiles\Lab04\Starter folder. When prompted, use Windows authentication to connect to
the database engine on the localhost server.

Review the script, and note that it creates a table named ReportSubscriptions, which contains the
following columns:

SubscriptionID a unique primary key

RecipientEmail the email address of a subscription recipient

ReportFormat the format in which the report should be rendered.

Linked a Boolean value that indicates whether the subscription email should include a link to
the report on the report server.

Execute the script and close SQL Server Management Studio.

Task 2: Create a data-driven subscription

In the Reports document library in the http://mia-sqlbi SharePoint site, in the drop-down list for the
Monthly Sales Report report, click Manage Subscriptions.

Click Add Data-Driven Subscription and add a subscription with the following settings:

Give the report the description Weekly Sales Report, and configure it to use the
AdventureWorksDW shared data source to retrieve subscription data with the following query.
SELECT * FROM ReportSubscriptions

Use the report default value for the CalendarYear parameter.

Lab Instructions: Managing Report Execution and Delivery

Use the E-Mail delivery type with the following settings:


To: Select a value from the database (select RecipientEmail)
Include Report: True
Render Format: Select a value from the database (select ReportFormat)
Subject: Specify a static value (enter Weekly sales report)
Comment: Specify a static value (enter The weekly sales report is attached)
Include Link: Select a value from the database (select Linked)

Schedule delivery on a custom schedule on the current day, two minutes from the current time
(You can determine the current system time by starting a command prompt window and
entering the commands and time /T. You can also use the command echo %date% to
determine the current day and date)

Task 3: Verify the subscription

In the Reports document library in the http://mia-sqlbi SharePoint site, in the drop-down list for the
Monthly Sales Report report, click Manage Subscriptions.

View the information about the subscription you created in the previous task. Then wait for two
minutes and refresh the page until the Last Results column indicates that the subscription has been
processed for 3 deliveries.

View the contents of the C:\inetpub\mailroot\Drop folder and verify that three email messages were
sent.

Open the email messages and verify that they contain the report in Excel, Word, and embedded
HTML formats.

Results: After this exercise, you should have created a data-driven subscription that delivers a report to
multiple recipients and in multiple formats by email.

Lab Instructions: Creating Multidimensional Databases

Module 5
Lab Instructions: Creating Multidimensional Databases
Contents:
Exercise 1: Creating a Data Source

Exercise 2: Creating and Modifying a Data Source View

Exercise 3: Creating and Modifying a Cube

Lab Instructions: Creating Multidimensional Databases

Lab: Creating a Multidimensional Database

Exercise 1: Creating a Data Source


Scenario
Users are finding the reporting solution at Adventure Works Cycles extremely useful, but many
information workers want to perform their own analysis of the data in Excel. To support this, you plan to
implement a multidimensional database. Initially, you need to create a connection and data source to the
data warehouse.
The main tasks for this exercise are as follows:
1.

Prepare the lab environment.

2.

Create a new SSAS project.

3.

Create a data source for the AdventureWorksDW relational database.

Task 1: Prepare the lab environment

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab05\Starter
folder as Administrator.

Task 2: Create a new SSAS project

Use SQL Server Data Tools to create a new SSAS project.

Name the project Adventure Works OLAP, and then save it in the D:\10778A\Labfiles\Lab05\Starter
folder.

Lab Instructions: Creating Multidimensional Databases

Task 3: Create a data source for the AdventureWorksDW relational database

Use the Data Source Wizard in SQL Server Data Tools.

The AdventureWorksDW database is on the local server.

Use Windows authentication to connect to the data source.

Use the ADVENTUREWORKS\Student account with the password Pa$$w0rd.

Name the data source Adventure Works Data Warehouse.

Results: After this exercise, you should see the Adventure Works Data Warehouse.ds data source in the
Data Sources folder.

Lab Instructions: Creating Multidimensional Databases

Exercise 2: Creating and Modifying a Data Source View


Scenario
The AdventureWorksDW database includes a large amount of data that is not required by your users
and the tables use naming conventions that are confusing to business analysts. You need to define which
tables you require and then change the names of the tables to be more user-friendly. Users have also
requested that they can retrieve full names of customers in addition to their first, middle, and last names.
The main tasks for this exercise are as follows:
1.

Create a data source view.

2.

Modify the data source view

Task 1: Create a data source view

Use the Data Source View Wizard in SQL Server Data Tools.

Use the Adventure Works Data Warehouse data source.

Include the DimCustomer, DimDate, DimGeography, DimProduct, and FactInternetSales tables.

Name the data source view Adventure Works DSV.

Task 2: Modify the data source view

Use the Data Source View Designer in SQL Server Data Tools to:

Change the FriendlyName property of FactInternetSales to InternetSales.

Change the FriendlyName property of the remaining tables to remove the Dim prefix from the
name.

Verify that the modified data source resembles the following image.

Add a named calculation named Full Name to the Customer table. The expression should
concatenate the FirstName, MiddleName (if it exists), and LastName columns.

Results: After this exercise, you have created a data source view for the cube that you need to create.

Lab Instructions: Creating Multidimensional Databases

Exercise 3: Creating and Modifying a Cube


Scenario
Now that you have created a data source view, you are ready to create a cube that enables business users
to perform multidimensional analysis on the data. You will then modify the cube to give the measures in
the cube user-friendly names to make analysis simpler for your business users. You will also add additional
attributes to dimensions to provide users with multiple ways to aggregate the measures.
You need to modify the attributes of the dimension used for dates in your cube to ensure uniqueness
across temporal periods. For example, the month of January is not unique because it occurs in every year,
so you must modify the month attribute so that its key is based on both month and year, and then specify
which of these key columns is to be used when displaying the attribute name.
The main tasks for this exercise are as follows:
1.

Create a cube.

2.

Modify the cube.

3.

Modify dimensions.

4.

Modify attribute columns.

5.

Browse the cube.

Task 1: Create a cube

Use the Cube Wizard in SQL Server Data Tools to create a new cube.

Build the cube by using existing tables.

Have the Cube Wizard suggest measure group tables.

Use all suggested dimensions other than Internet Sales.

Name the cube Adventure Works Cube.

Verify that the cube resembles the following image.

Lab Instructions: Creating Multidimensional Databases

Task 2: Modify the cube

Change the name of the Unit Price Discount Pct measure to Unit Price Discount Percent.

Change the name of the Tax Amt measure to Tax Amount.

Task 3: Modify dimensions

Modify the Customer dimension in Dimension Designer.

Add the City, StateProvinceName, EnglishCountryRegionName, and SalesTerritoryKey


attributes from the Geography table to the dimension.

Add the CustomerAlternateKey, Title, FirstName, MiddleName, LastName, and Full Name
attributes from the Customer table to the dimension.

Verify that the modified dimension resembles the following image:

Modify the Product dimension in Dimension Designer.

Add the ProductAlternateKey, ProductSubcategoryKey, EnglishProductName, and ListPrice


attributes from the Product table to the dimension.

Lab Instructions: Creating Multidimensional Databases

Verify that the modified dimension resembles the following image:

Modify the Date dimension in Dimension Designer.

Add the EnglishDayNameOfWeek, EnglishMonthName, MonthNumberOfYear,


CalendarQuarter, CalendarYear, and CalendarSemester attributes from the Date table to the
dimension.

Verify that the modified dimension resembles the following image:

Lab Instructions: Creating Multidimensional Databases

Task 4: Modify attribute columns

In the dimension designer for the Date dimension, modify the Calendar Semester attribute so that a
semester is uniquely identified by both the calendar year and the calendar semester, but displayed
using only the calendar semester value:

In the properties for the Calendar Semester attribute, set the KeyColumns property so that the
key columns are CalendarYear followed by CalendarSemester.

Set the NameColumn property so that the Source column value is Calendar Semester.

Modify the Calendar Quarter attribute so that the keys that a quarter is uniquely identified by both
the calendar year and the calendar quarter, but displayed using only the calendar quarter value:

In the properties of the Calendar Quarter attribute, set the KeyColumns property so that the
key columns are CalendarYear followed by CalendarQuarter.

Set the NameColumn property so that the Source column value is Calendar Quarter.

Modify the English Month Name attribute so that a month is uniquely identified by both the
calendar year and the month number of year, but displayed using the month name value:

In the properties for the English Month Name attribute, change the Name property to Month.

Set the KeyColumns property so that the key columns are Calendar Year followed by
MonthNumberOfYear.

Set the NameColumn property so that the Source column value is EnglishMonthName.

Task 5: Browse the cube

Deploy the Adventure Works OLAP project, entering the user name ADVENTUREWORKS\Student
and the password Pa$$w0rd if prompted. Then use Cube Browser to view the Adventure Works
Cube cube.

Add the Sales Amount and Internet Sales Count measures to the data area, and then drag the
Order Date.Calendar Year hierarchy to the left of the Sales Amount column. The cube browser
shows sales amounts and counts for multiple years as shown in the following image.

Lab Instructions: Creating Multidimensional Databases

Open Microsoft Excel 2010, and then on the Data tab, make a connection to get external data from
Analysis Services.

Your connection should connect to the localhost server by using Windows authentication.

You should select the Adventure Works OLAP database.

You should import the data as a PivotTable Report in cell A1 of the existing worksheet.

When the PivotTable Field List pane is displayed, under Internet Sales, select Sales Amount; and
under Customer, select Full Name so that the PivotTable resembles the following image.

Results: After this exercise, you should have successfully deployed the cube and reviewed the
modifications made to ensure that they are reflected when users browse the cube.

Lab Instructions: Working with Cubes and Dimensions

Module 6
Lab Instructions: Working with Cubes and Dimensions
Contents:
Exercise 1: Configuring Dimensions

Exercise 2: Defining Relationships and Hierarchies

Exercise 3: Sorting and Grouping Dimension Attributes

10

Lab Instructions: Working with Cubes and Dimensions

Lab: Defining Dimensions

Exercise 1: Configuring Dimensions


Scenario
Several users in the Adventure Works Cycle company have reported that they want to be able to view
data across time periods, so you need to configure the Date dimension as a Time dimension so that
Analysis Services can apply temporal calculations to values in this dimension.
The main tasks for this exercise are as follows:
1.

Prepare the lab environment.

2.

Remove unused attributes from dimensions.

3.

Add dimension intelligence.

Task 1: Prepare the lab environment

Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab06\Starter
folder as Administrator.

Task 2: Remove unused attributes from dimensions

Open the Adventure Works OLAP.sln solution in the D:\10778A\Labfiles\Lab06\Starter folder in SQL
Server Data Tools.

Open the Customer dimension in the dimension designer and note that many attributes have been
added to this dimension to allow business users to aggregate measures in many different ways.
However, users have complained that some of these attributes are unnecessary and that they should
be removed to make browsing the cube simpler.

Lab Instructions: Working with Cubes and Dimensions

Delete the Commute Distance, Number Cars Owned, and Number Children At Home attributes
from the Customer dimension.

Delete the Days To Manufacture and Safety Stock Level attributes from the Product dimension.

Task 3: Add dimension intelligence

Use the Business Intelligence Wizard on the Date dimension to define dimension intelligence.

Specify that the dimension is a Time dimension.

Map the dimension attribute columns as follows:


Attribute Type

Dimension Attribute

Year

Calendar Year

Half Year

Calendar Semester

Quarter

Calendar Quarter

Month

Month

Date

Simple Date

Results: After this exercise, the Customer and Product dimensions have had some attributes removed,
and time intelligence has been added to the Date dimension.

Lab Instructions: Working with Cubes and Dimensions

Exercise 2: Defining Relationships and Hierarchies


Scenario
Another way in which users want to simplify analysis is to group dimension attributes into hierarchies that
can be used to summarize data at multiple levels. Specifically, dates must be organized in temporal
hierarchies, such as years, semesters, quarters, and months; customers should be grouped into hierarchies
based on their geographical address and their marital status and gender; and products should be
grouped based on their category and subcategory.
The main tasks for this exercise are as follows:
1.

Create attributes in the Date dimension.

2.

Create a natural hierarchy in the Date dimension.

3.

Create attribute relationships in the Customer dimension

4.

Create hierarchies in the Customer dimension.

5.

Create attribute relationships in the Product dimension.

6.

Create hierarchies in the Product dimension.

7.

Browse the hierarchies you have created.

Task 1: Create attribute relationships in the Date dimension

Open the Date dimension in Dimension Designer.

In the Attribute Relationships tab, create the following new attribute relationships. Note that all of
these relationships are rigid (because, for example, a particular month will always be in the same
calendar quarter).
Source Attribute

Related Attribute

Relationship Type

Simple Date

Month

Rigid (will not change over time)

Month

Calendar Quarter

Rigid (will not change over time)

Calendar Quarter

Calendar Semester

Rigid (will not change over time)

Calendar Semester

Calendar Year

Rigid (will not change over time)

Lab Instructions: Working with Cubes and Dimensions

When you have finished, the Attribute Relationships pane should resemble the following image.

Task 2: Create a natural hierarchy in the Date dimension

In the Dimension Structure for the Date dimension, create a hierarchy based on the relationships
you created in the previous task:

Drag the Calendar Year attribute to the Hierarchies pane.

Add the following attributes to the <new level> indicator in the hierarchy in this order:
Calendar Semester
Calendar Quarter
Month
Simple Date

Change the hierarchy name to Calendar Date.

The completed hierarchy should resemble the following image.

Set the AttributeHierarchyVisible property of all of the attributes you added to the hierarchy to
False. This defines these attributes as member properties rather than hierarchies in their own
right, so that users can only browse them through the Calendar Date hierarchy.

Lab Instructions: Working with Cubes and Dimensions

Task 3: Create attribute relationships in the Customer dimension

Open the Customer dimension in Dimension Designer.

In the Attribute Relationships tab, create the following new attribute relationships. Note that all of
these relationships are flexible (because, for example, a particular city could potentially be redesignated as belonging to a different state; or a customer who is single could get married).
Source Attribute

Related Attribute

Relationship Type

Postal Code

City

Flexible (may change over time)

City

State-Province Name

Flexible (may change over time)

State-Province Name

English Country Region Name

Flexible (may change over time)

Marital Status

Gender

Flexible (may change over time)

When you have finished, the Attribute Relationships pane should resemble the following image.

Task 4: Create hierarchies in the Customer dimension

In the Dimension Structure for the Customer dimension, create a hierarchy based on the
relationships you created in the previous task:

Drag the English Country Region Name attribute to the Hierarchies pane.

Lab Instructions: Working with Cubes and Dimensions

Add the State Province Name, City, Postal Code, and Full Name attributes to the hierarchy.

Change the hierarchy name to Customer Geography, so that the completed hierarchy resembles
the following image.

Create a second hierarchy named Gender - Marital Status in this dimension, with levels for Gender
and Marital Status, as shown in the following image.

Set the AttributeHierarchyVisible property of all of the attributes you added to the hierarchies to
False.

Task 5: Create attribute relationships in the Product dimension

Open the Product dimension in Dimension Designer.

In the Attribute Relationships tab, create the following new attribute relationships. Note that all of
these relationships are flexible (because, for example, a particular product could potentially be recategorized as belonging to a different subcategory).
Source Attribute

Related Attribute

Relationship Type

English Product Name

English Product Subcategory Name

Flexible (may
change over time)

English Product Subcategory Name

English Product Category Name

Flexible (may
change over time)

Lab Instructions: Working with Cubes and Dimensions

When you have finished, the Attribute Relationships pane should resemble the following image.

Task 6: Create hierarchies in the Product dimension

In the Dimension Structure for the Product dimension, create a hierarchy based on the relationships
you created in the previous task:

Drag the English Product Category Name attribute to the Hierarchies pane.

Add the English Product Subcategory Name and English Product Name attributes to the
hierarchy.

Change the hierarchy name to Product Category, so that the completed hierarchy should
resemble the following image.

Set the AttributeHierarchyVisible property of all of the attributes you added to the hierarchies to
False.

Lab Instructions: Working with Cubes and Dimensions

Task 7: Browse the hierarchies you have created

Deploy the Adventure Works OLAP project, entering the user name ADVENTUREWORKS\Student
and the password Pa$$w0rd if prompted.

Browse the Customer dimension, and verify that the Customer Geography and Gender Marital
Status hierarchies behave as expected.

Open the Adventure Works Cube.cube cube in the cube designer, and then on the Browse tab,
view the Sales Amount measure aggregated by the Product Category hierarchy, and verify that the
hierarchy displays product by category, subcategory, and product name.

Results: After this exercise, you should have created a Calendar Date hierarchy, a Customer Geography
hierarchy, a Gender - Marital Status hierarchy, and a Product Category hierarchy.

10

Lab Instructions: Working with Cubes and Dimensions

Exercise 3: Sorting and Grouping Dimension Attributes


Scenario
Users in Adventure Works Cycles have noticed that when browsing data by month, the data is sorted
alphabetically instead of in chronological order. They have asked you to correct this behavior so that
months are shown in calendar order. Additionally, when analyzing customer data by salary, users have
come to the conclusion that it would be more useful to group customer salaries into discrete bands rather
than view data by individual salary amounts. You have therefore been asked to create salary groupings for
customer data.
The main tasks for this exercise are as follows:
1.

Modify the sort order of the Month attribute.

2.

Group the Yearly Income attribute hierarchy members.

Task 1: Modify the sort order of the Month attribute

Open the Date dimension in Dimension Designer, and browse Calendar Date hierarchy. Note that
the month level is sorted in alphabetical rather than chronological order.

On the Dimension Structure tab for the Date dimension, modify the following properties of the
Month Number of Year attribute:

AttributeHierarchyOptimizedState: NotOptimized

AttributeHierarchyOrdered: False

On the Attribute Relationships tab, create the following attribute relationship.


Source Attribute
Month

Related Attribute
Month Number of Year

Relationship Type
Rigid (will not change over time)

On the Dimension Structure tab for the Date dimension, modify the following properties of the
Month attribute:

OrderBy: AttributeKey

OrderByAttribute: Month Number Of Year

Deploy the project and browse the Calendar Date hierarchy to verify that the values are now sorted
in the correct order.

Lab Instructions: Working with Cubes and Dimensions

Task 2: Group the Yearly Income attribute hierarchy members

Open the Customer dimension in Dimension Designer, and browse Yearly Income hierarchy. Note
that the salaries have no hierarchy, as shown in the following image.

On the Dimension Structure tab for the Customer dimension, modify the following properties of
the Yearly Income attribute:

DiscretizationMethod: Automatic

DiscretizationBucketCount: 5

OrderBy: Key

Deploy the project and browse the Yearly Income hierarchy to verify that the values are now
grouped into salary bands are shown in the following image.

Open Adventure Works Cube in the cube designer and browse the cube to view the Internet sales
amount by customer yearly income. Verify that the sales are aggregated by the salary bands you
defined for the Yearly Income hierarchy.

Results: After this exercise, you should be able to view the correctly sorted and grouped dimensions in
the cube.

11

Lab Instructions: Working with Measures and Measure Groups

Module 7
Lab Instructions: Working with Measures and Measure
Groups
Contents:
Exercise 1: Configuring Measures

Exercise 2: Defining a Regular Relationship

Exercise 3: Configuring Measure Group Storage

Lab Instructions: Working with Measures and Measure Groups

Lab: Configuring Measures and Measure Groups

Exercise 1: Configuring Measures


Scenario
You are refining the OLAP cube for your company. Your users can currently view measures for Internet
sales, but you have additional data for reseller sales in your data warehouse and they would like to
analyze this data as well as Internet sales. When you add the reseller sales measures, your users have
requested that you remove some measures that are not required for business analysis, and ensure that the
measures in the cube are clearly named.
In this exercise, you will configure format strings and display folders for measures.
The main tasks for this exercise are as follows:
1.

Prepare the lab environment.

2.

Create a measure group.

3.

Modify measure groups.

Task 1: Prepare the lab environment

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab07\Starter
folder as Administrator.

Lab Instructions: Working with Measures and Measure Groups

Task 2: Create a measure group

Use SQL Server Data Tools to open the Adventure Works OLAP.sln solution in the
D:\Labfiles\Lab07\Starter folder.

Open the Adventure Works DSV data source view and add the FactResellerSales table, together
with all related tables.

Open Adventure Works Cube in cube designer, and add a new measure group named Reseller
Sales based on the FactResellerSales table.

Review the names of the measures in both the Internet Sales and Reseller Sales measure groups.
Note that when the Reseller Sales measure group was created, measures were created for all of the
numerical fields in the FactResellerSales table. In cases where an measure with the same field name
already existed, a new measure was created with - Fact Reseller Sales appended to its name, as
shown in the following image.

Lab Instructions: Working with Measures and Measure Groups

Task 3: Modify measure groups

Delete the following measures from the cube.


Tip Click the Show Measures Grid icon to view all of the measures in the cube as a grid.
In this view, you can multi-select measures by holding the Ctrl key.

Promotion Key

Currency Key

Sales Territory Key

Revision Number

Extended Amount

Unit Price Discount Percent

Discount Amount

Product Standard Cost

Freight

Revision Number Fact Reseller Sales

Extended Amount Fact Reseller Sales

Unit Price Discount Pct

Discount Amount Fact Reseller Sales

Product Standard Cost Fact Reseller Sales

Freight Fact Reseller Sales

Rename the following measures:


Measure

Rename to:

Order Quantity

Order Quantity Internet Sales

Unit Price

Unit Price Internet Sales

Total Product Cost

Total Product Cost Internet Sales

Sales Amount

Sales Amount Internet Sales

Tax Amount

Tax Amount Internet Sales

Order Quantity Fact Reseller Sales

Order Quantity Reseller Sales

Unit Price Fact Reseller Sales

Unit Price Reseller Sales

Total Product Cost Fact Reseller Sales

Total Product Cost Reseller Sales

Sales Amount Fact Reseller Sales

Sales Amount Reseller Sales

Tax Amt

Tax Amount Reseller Sales

Fact Reseller Sales Count

Reseller Sales Count

Lab Instructions: Working with Measures and Measure Groups

When you view the modified measures as a tree, they should resemble the following image.

Results: After this exercise, you should have created a new measure group for the FactResellerSales
table, removed unrequired measures, and renamed measures.

Lab Instructions: Working with Measures and Measure Groups

Exercise 2: Defining a Regular Relationship


Scenario
Your users have specifically stated that they must be able to analyze reseller sales by product, so you must
create the required relationships to support aggregating reseller sales measures by the Product
dimension.
In this exercise, you will create a regular relationship.
The main task for this exercise is as follows:
1.

View existing dimensions for measure groups.

2.

Create a dimension.

Task 1: View existing dimensions for measure groups

Deploy the Adventure Works OLAP project, entering the user name ADVENTUREWORKS\Student
and the password Pa$$w0rd if prompted.

Open Adventure Works Cube in the cube designer, and on the Browse tab, review the measures
and dimensions available for each measure group by selecting each measure group in turn in the
Measure Group drop-down list in the Metadata pane.

When the Internet Sales measure group is selected, the Product dimension should be listed.

When the Reseller Sales measure group is selected, there is no Product dimension.

Task 2: Create a dimension

On the Dimensions Usage tab of the cube designer for Adventure Works Cube, define a regular
relationship at the intersection of the Reseller Sales measure group and the Product dimension.

Define the relationship at the Product Key level of granularity.

Select ProductKey as the measure group column.


When you have defined the relationship, the Dimensions Usage tab should resemble the
following image.

Deploy the Adventure Works OLAP project, and then browse the cube, verifying that you can view
Sales Amount Reseller Sales by Product Category.

Results: After this exercise, you should have defined a regular relationship to enable you to analyze
reseller sales data.

Lab Instructions: Working with Measures and Measure Groups

Exercise 3: Configuring Measure Group Storage


Scenario
Users have requested that the cube should be optimized to improve performance when analyzing
Internet sales. However, you must balance this need for optimization against the space required to store
aggregations.
The main tasks for this exercise are as follows:
1.

Configure the storage mode of the Internet Sales measure group.

2.

Design aggregations for the Internet Sales measure group.

Task 1: Configure the storage mode of the Internet Sales measure group

Configure proactive caching for the Internet Sales measure group in the Adventure Works Cube
cube.

Specify that the Automatic MOLAP setting should be used.

Task 2: Design aggregations for the Internet Sales measure group

Use the Aggregation Design Wizard to design aggregations for the Internet Sales measure group in
the Adventure Works Cube cube.

Set all aggregation usage to the default before starting the configuration.

Use the wizard to count the objects in the measure group.

Generate aggregations until the performance gain reaches 35%.

Name the aggregation you have generated InternetSalesAgg.

Deploy the Adventure Works OLAP project, entering the user name ADVENTUREWORKS\Student
and the password Pa$$w0rd if prompted. Then close SQL Server Data Tools.

Start SQL Server Management Studio and connect to the localhost instance of Analysis Services.

In Object Explorer, expand Databases, expand Adventure Works OLAP, expand Cubes, expand
Adventure Works Cube, expand Measure Groups, expand Internet Sales, and expand
Aggregation Designs to verify that the InternetSalesAgg aggregation has been deployed.

Results: After this exercise, you should have defined the storage mode aggregations and for the Internet
Sales measure group.

Lab Instructions: Introduction to MDX

Module 8
Lab Instructions: Introduction to MDX
Contents:
Exercise 1: Querying a Cube by Using MDX

Exercise 2: Creating a Calculated Member

Lab Instructions: Introduction to MDX

Lab: Using MDX

Exercise 1: Querying a Cube by Using MDX


Scenario
You are a BI developer for the Adventure Works Cycles company, and you are creating a custom analysis
application for the Chief Finance Officer (CFO). The application must return sales data for products,
customers, and dates from the Adventure Works Cube, so you have initially decided to experiment with
MDX syntax to query the cube and retrieve business data.
In this exercise, you will write multiple MDX queries to obtain the necessary information for the sales
management team.
The main tasks for this exercise are as follows:
1.

Prepare the lab environment.

2.

Deploy an OLAP database.

3.

Write simple MDX queries.

4.

Write an MDX query to return data on rows and columns.

Task 1: Prepare the lab environment

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab08\Starter
folder as Administrator.

Lab Instructions: Introduction to MDX

Task 2: Deploy an OLAP database

Use SQL Server Data Tools to open the Adventure Works OLAP.sln solution in the
D:\10778A\Labfiles\Lab08\Starter folder. Then deploy the solution, entering the user name
ADVENTUREWORKS\Student and the password Pa$$w0rd if prompted.

When deployment has completed successfully, close SQL Server Data Tools.

Task 3: Write simple MDX queries

In SQL Server Management Studio, connect to the localhost instance of Analysis Services, and then
create and execute a new MDX query in the Adventure Works OLAP database that displays the
Sales Amount Internet Sales measure for each product category.

Use the following MDX code:


SELECT
[Measures].[Sales Amount Internet Sales] On 0,
NonEmpty([Product].[Product Category].[English Product Category Name].Members) On 1
FROM [Adventure Works Cube]

Create and execute another MDX query that that displays the Internet Sales Count measure for each
English Country Region Name in the Customer Geography hierarchy.

Use the following MDX code:


SELECT
[Measures].[Internet Sales Count] On 0,
NonEmpty([Customer].[Customer Geography].[ English Country Region Name].Members) On
1
FROM [Adventure Works Cube]

Task 4: Write an MDX query to return data on rows and columns

In SQL Server Management Studio, create and execute an MDX query that returns the Sales Amount
measure with calendar years from the Calendar Date hierarchy on columns and cities from the
Customer Geography hierarchy on rows.

Use the following MDX code:


SELECT
NonEmpty([Order Date].[Calendar Date].[Calendar Year].Members) ON COLUMNS,
[Customer].[Customer Geography].[City].Members ON ROWS
FROM [Adventure Works Cube]
WHERE [Measures].[Sales Amount - Internet Sales]

Results: After this exercise, you should have written MDX queries to return data from the Adventure
Works Cube cube.

Lab Instructions: Introduction to MDX

Exercise 2: Creating a Calculated Member


Scenario
The CFO has also asked you to extend the cube to include measures for profit and gross profit margin, so
you must create calculated members for these and ensure that you can include them in queries from the
custom application you plan to build.
In this exercise, you will create a calculated member to aggregate sales information and two additional
calculated members that return gross profit margins.
The main tasks for this exercise are as follows:
1.

Define a Profit calculated member based on physical measures.

2.

Define gross profit margin calculations.

3.

Query the new calculated members.

Task 1: Define a Profit calculated member based on physical measures

Use SQL Server Data Tools to open the Adventure Works OLAP.sln solution in the
D:\10778A\Labfiles\Lab08\Starter\Adventure Works OLAP folder.

On the Calculations tab of the cube designer for Adventure Works Cube.cube, create a new
calculated member named [Profit] that subtracts the Total Product Cost Internet Sales measure
from the Sales Amount Internet Sales measure.

Format the calculated member as currency, add the fields used in the expression to the Non-empty
behavior list, and associate the calculated member with the Internet Sales measure group. The
completed calculated member should match the following image.

Lab Instructions: Introduction to MDX

Task 2: Define gross profit margin calculations

Create a second new calculated member named [Gross Profit Margin] that subtracts the Total
Product Cost Internet Sales measure from the Sales Amount Internet Sales measure and then
divides by Sales Amount Internet Sales to return a percentage.

Format the new calculated member to display as a percentage, add the Sales Amount Internet
Sales measure to the Non-empty behavior list, and associate the calculated member with the
Internet Sales measure group . The completed calculated member should match the following
image.

Deploy the solution, overwriting the existing database and entering the user name
ADVENTUREWORKS\Student and the password Pa$$w0rd if prompted. Then close SQL Server Data
Tools.

Task 3: Query the new calculated members

In SQL Server Management Studio, create and execute a new MDX query to return the calculated
measures.

Use the following MDX code.


SELECT
{[Measures].[Profit], [Measures].[Gross Profit Margin]} ON COLUMNS,
NonEmpty([Product].[Product Category].[English Product Category Name]) ON ROWS
FROM [Adventure Works Cube]

Results: After this exercise, you should have created two calculated members and then queried them.

Lab Instructions: Customizing Cube Functionality

Module 9
Lab Instructions: Customizing Cube Functionality
Contents:
Exercise 1: Implementing an Action

Exercise 2: Implementing a Perspective

Exercise 3: Implementing a Translation

Lab Instructions: Customizing Cube Functionality

Lab: Customizing a Cube

Exercise 1: Implementing an Action


Scenario
Information workers in the sales department at Adventure Works Cycles currently use the cube you have
created to perform analysis of sales data. Several users have expressed a desire to be able to view
aggregated sales figures in Excel, and then quickly drill-through to see details of specific orders for a
given aggregation for example, when viewing the sales total for bikes in 2003, the users want to be able
to quickly generate a second Excel worksheet that shows details of the customer, location, date, and
individual product for each bike sale in that year.
The main tasks for this exercise are as follows:
1.

Prepare the lab environment.

2.

Deploy an OLAP database.

3.

Create a drillthrough action.

4.

Browse a drillthrough action.

Task 1: Prepare the lab environment

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab09\Starter
folder as Administrator.

Lab Instructions: Customizing Cube Functionality

Task 2: Deploy an OLAP database

Use SQL Server Data Tools to open the Adventure Works OLAP.sln solution in the
D:\10778A\Labfiles\Lab09\Starter folder. Then deploy the solution, entering the user name
ADVENTUREWORKS\Student and the password Pa$$w0rd if prompted.

Process the solution.

Task 3: Create a drillthrough action

In SQL Server Data Tools, on the Calculations tab of the cube designer for Adventure Works
Cube.cube, create a new drillthrough action named Internet Sales Details Drillthrough Action.

Specify Internet Sales in the Measure group members list.

Specify the following dimensions and return columns.


Dimension

Return Columns

Customer

English Country Region Name and Full Name

Order Date

Simple Date

Product

English Product Name

Specify the caption Drillthrough to order details

Verify that the completed action resembles the following image, and then deploy the solution,
entering the user name ADVENTUREWORKS\Student and the password Pa$$w0rd if prompted.

Lab Instructions: Customizing Cube Functionality

Task 4: Browse a drillthrough action

In SQL Server Data Tools, on the Browser tab of the cube designer for Adventure Works
Cube.cube, click the Analyze in Excel icon to create a Microsoft Excel workbook with a connection
to cube. If a security notice is displayed, click Enable.

In Excel, use the PivotTable to view Sales Amount Internet Sales with Order Date.Calendar Date
on columns and Product Category on rows, as shown in the following image.

In the PivotTable, right-click the sales amount for Bikes in 2003 (cell D4 in the image above), point to
Additional Actions, and click Drillthrough to order details.The order details for bikes in 2003
should be displayed in a new worksheet as shown in the following image.

Lab Instructions: Customizing Cube Functionality

When you have viewed the order details returned by the drillthrough action, close Excel without
saving your changes, and keep SQL Server Data Tools open for the next exercise.

Results: After this exercise, you should have defined a drillthrough action.

Lab Instructions: Customizing Cube Functionality

Exercise 2: Implementing a Perspective


Scenario
Some sales users are finding the cube too complex for their needs. These users typically only need to
analyze sales amount by customer, and would like to be able to view only the measures and dimensions
required to support this requirement.
The main tasks for this exercise are as follows:
1.

Define a Sales Summary perspective.

2.

Browse the cube using the Sales Summary perspective.

Task 1: Define a Sales Summary perspective

In SQL Server Data Tools, on the Perspectives tab of the cube designer for Adventure Works
Cube.cube, create a new perspective named Sales Summary.

Include only the following cube objects in the perspective.


Cube Object

Object Type

Sales Amount Internet Sales

Measure in the Internet Sales MeasureGroup

Customer

CubeDimension

The completed perspective should resemble the following image.

Lab Instructions: Customizing Cube Functionality

Task 2: Browse the cube using the Sales Summary perspective

Deploy the solution, entering the user name ADVENTUREWORKS\Student and the password
Pa$$w0rd if prompted.

On the Browser tab of the cube designer for Adventure Works Cube.cube, reconnect to the cube
and if necessary, clear any existing values from the data grid and filter areas.

In the Cube Selection area above the Metadata pane, select the Sales Summary perspective, and
browse the cube, noting that only the Sales Amount Internet Sales measure and Customer
dimension are available.

In the Cube Selection area, select the Adventure Works Cube perspective, and note that all
measures and dimensions defined in the cube are available.

Keep SQL Server Data Tools open for the next exercise.

Results: After this exercise, you should have defined a perspective and browsed the cube using the new
perspective.

Lab Instructions: Customizing Cube Functionality

Exercise 3: Implementing a Translation


Scenario
The company employs a number of senior sales managers whose first language is French. These users
would like to be able to view cube data and metadata in French.
In this exercise you will add the final enhancement to the revenue information cube by specifying
translations for the French speakers in your company.
The main tasks for this exercise are as follows:
1.

Specify translations for the Time Dimension metadata.

2.

Specify translations for the Adventure Works cube metadata.

3.

Browse the cube using the new translations.

Task 1: Specify translations for the Time Dimension metadata

Using the dimension designer for the Date dimension, create a French (France) translation.

For the Caption object of the Date dimension, under the French (France) column, enter Date.

For the Caption object of the Month Number of Year attribute, under the French (France) column,
enter Mois d'Anne.
Tip To type hold the Alt key and type 130 using the number pad on your keyboard
ensuring NumLock is turned on. If this is not possible type the captions without accents.

Click the ellipses for the French Mois d'Anne attribute and modify the attribute data translation to
use the FrenchMonthName column as shown in the following image.

Lab Instructions: Customizing Cube Functionality

Verify that the Translations tab for the Date dimension resembles the following image, and then
save all files in the solution.

Task 2: Specify translations for the Adventure Works cube metadata

On the Translations tab of the cube designer for Adventure Works Cube.cube, create a new
French (France) translation with the following caption translations.

Internet Sales measure group: Ventes d'Internet.

Sales Amount Internet Sales measure: Ventes Total.

10

Lab Instructions: Customizing Cube Functionality

Verify that the Translations tab for the Adventure Works Cube cube resembles the following
image, and then save all files in the solution.

Task 3: Browse the cube using the new translations

Deploy the solution, entering the user name ADVENTUREWORKS\Student and the password
Pa$$w0rd if prompted.

On the Browser tab of the cube designer for Adventure Works Cube.cube, reconnect to the cube
and if necessary, clear any existing values from the data grid and filter areas.

Select French (France) in the Language list.

Browse the cube to show the Ventes Total measure in the Ventes dInternet measure group
aggregated by the Order Date.Mois dAnne hierarchy.

Results: After this exercise, you have specified translations for the time dimension metadata and for the
Adventure Works cube metadata, and browsed the cube using the new translations.

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

Module 10
Lab Instructions: Implementing a Tabular Data Model with
Microsoft PowerPivot
Contents:
Exercise 1: Creating a Tabular Data Model by Using PowerPivot for Excel

Exercise 2: Using a Tabular Data Model in Excel

Exercise 3: Sharing a PowerPivot Workbook to PowerPivot Gallery

13

Exercise 4: Using a PowerPivot Workbook as a Data Source

15

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

Lab: Using PowerPivot for Excel

Exercise 1: Creating a Tabular Data Model by Using PowerPivot for Excel


Scenario
Information workers at Adventure Works currently use reports to view business information. However,
some power users want to be able to obtain a deeper understanding of the data by taking advantage of
the powerful analysis features of Excel 2010. In addition to Excel, you plan to install the PowerPivot for
Excel add-in, which enables these power users to create their own tabular data models for data analysis.
You also plan to install PowerPivot for SharePoint so that they can easily share these models with other
interested users. You want to test the features and functionality of these products before you roll them
out.
The main tasks for this exercise are as follows:

1.

Prepare the lab environment.

2.

Import data into a PowerPivot for Excel workbook.

3.

Rename columns in a PowerPivot for Excel workbook.

4.

Import data into a PowerPivot for Excel workbook by using a query.

5.

Create a relationship manually.

6.

Create a hierarchy.

7.

Hide tables from client tools.

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

Task 1: Prepare the lab environment

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab10\Starter
folder as Administrator.

Task 2: Import data into a PowerPivot for Excel workbook

Start Microsoft Excel 2010, and open the PowerPivot Window.

Import the following tables from the AdventureWorksDW database on the localhost instance of
SQL Server.
Table

Friendly Name

Columns Removed by Filter

DimDate

Date

SpanishDayNameOfWeek
FrenchDayNameOfWeek
SpanishMonthName
FrenchMonthName

DimEmployee

Employee

LoginID
EmailAddress
Phone
EmergencyContactName
EmergencyContactPhone

DimProduct

Product

SpanishProductName
FrenchProductName
FrenchDescription
ChineseDescription
ArabicDescription
HebrewDescription
ThaiDescription
GermanDescription
JapaneseDescription
TurkishDescription

DimProductCategory

Product Category

SpanishProductCategoryName
FrenchProductCategoryName
Image

DimProductSubcategory

Product Subcategory

SpanishProductSubcategoryName
FrenchProductSubcategoryName

DimSalesTerritory

Sales Territory

FactResellerSales

Reseller Sales

Save the workbook in the D:\10778A\Labfiles\Lab10\Starter folder as Sales Overview.xlsx.

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

The PowerPivot window should resemble the following image.

Task 3: Rename columns in a PowerPivot for Excel workbook

Rename the columns in the following tables.


Table Name

Existing Column Name

New Column Name

Date

EnglishDayNameOfWeek

Day

Date

EnglishMonthName

Month

Date

CalendarYear

Calendar Year

Date

FiscalYear

Fiscal Year

Employee

FirstName

First Name

Employee

LastName

Last Name

Product

EnglishProductName

Product

Product Category

EnglishProductCategoryName

Category

Product Subcategory

EnglishProductSubcategoryName

Subcategory

Sales Territory

SalesTerritoryCountry

Country

Reseller Sales

TotalProductCost

Total Product Cost

Reseller Sales

SalesAmount

Sales Amount

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

Task 4: Import data into a PowerPivot workbook by using a query

Import data from the DimGeography table in the AdventureWorksDW database on localhost into
the data model by using a query. The query should include all columns other than the following (tip:
You can use the visual query designer in the Table Import Wizard to create the query).

SpanishCountryRegionName

FrenchCountryRegionName

PostalCode

IpAddressLocator

After you have imported the data, rename the imported table to Geography.

The imported table should look similar to this:

Task 5: Create a relationship manually

View the diagram for the data model, and drag the SalesTerritoryKey column from the Sales
Territory table to the SalesTerritoryKey column in the Geography table to create a relationship
between these tables as shown here (you may need to rearrange the tables in the diagram).

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

Task 6: Create a hierarchy

In data view, add a new column named Subcategory to the Product table. The column should use
the following DAX formula.
=RELATED('Product Subcategory'[Subcategory])

Add a second new column named Category to the Product table. This column should use the
following DAX formula.
=RELATED('Product Category'[Category])

Note These DAX formulas create calculated columns in the Product table that use the
RELATED function to bring the data in the Category and Subcategory columns into the
Product table. You will learn more about writing DAX formulas in Module 11 of this course,
Introduction to DAX.
The new columns in the Product table should resemble the following image. The first 200 products
have no subcategory or category, so you will need to scroll down to see the values.

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

View the diagram for the data mode, and in the Product table, create a hierarchy named Products
that contains the Category, Subcategory, and Product columns (in that order), as shown here.

Task 7: Hide tables from client tools

In data view, right-click the Product Category table tab, and then click Hide from Client Tools.

Hide the Product Subcategory table in the same way. The PowerPivot window should now look like
this:

Save the Sales Overview.xslx workbook.

Results: After this exercise, you should have created and saved a PowerPivot workbook.

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

Exercise 2: Using a Tabular Data Model in Excel


Scenario
You are continuing to explore the capabilities of PowerPivot for Excel before you roll it out to your users.
The main tasks for this exercise are as follows:
1.

Create a PivotTable table.

2.

Create a measure.

3.

Add formatting to a PivotTable table.

4.

Create PivotChart charts.

5.

Add slicers.

Task 1: Create a PivotTable table

In Excel, switch to the empty workbook.

Add a PowerPivot PivotTable to cell B2 in the Sheet 1 worksheet in Excel.

Add the Sales Amount and Total Product Cost columns from the Reseller Sales table to the
PivotTable.

Add the Products hierarchy from the Product table to rows of the PivotTable.
The workbook should resemble the following image.

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

Task 2: Create a measure

In the PowerPivot Field List, right-click Reseller Sales, and then click Add New Measure

Use the following DAX formula to create a measure named Total Profit in the Reseller Sales table.
=SUM('Reseller Sales'[Sales Amount]) - SUM('Reseller Sales'[Total Product Cost])

Format the measure as currency.


The measure settings for the Total Profit measure should look like this:

The Total Profit measure is added to the PivotTable.

Task 3: Add formatting to a PivotTable table

On the ribbon, in the PivotTable Tools group, click the Design tab, and in the PivotTable Styles
section, select a visual style for the PivotTable.

On the ribbon, in the Layout group, click Blank Rows, and then select the Insert Blank Line after
Each Item option.

On the ribbon, click the Home tab.

In the PivotTable table, select all of the rows in the Total Profit column (do not include the Total
Profit header row). In the Styles area, add conditional formatting. Use the GreenYellow-Red color
scale.

Expand the rows in the PivotTable table to view the effects of the formatting options that you
configured.

10

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

Task 4: Create PivotChart charts

Click in cell G9, and then on the PowerPivot tab, add a PivotChart to the existing worksheet.

In the PowerPivot Field List pane, drag the following fields to the appropriate chart layout sections to
create the chart.
Table

Field

Chart Area

Reseller Sales

Sales Amount

Values

Product

Category

Axis Fields

Date

Calendar Year

Legend Fields

Use the PivotChart tools in Excel to format the chart so that it looks similar to the following image.

In cell G30, add a second PivotChart that uses the following fields:
Table

Field

Chart Area

Reseller Sales

Sales Amount

Values

Sales Territory

Country

Axis Fields

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

11

Format the second chart and change its chart type so that it resembles the following image.

Task 5: Add slicers

Click the PivotTable table that you created in Task 1.

Add two horizontal slicers. One that uses the Country column in the Sales Territory table and one
that uses the Calendar Year column in the Date table. The workbooks should resemble the following
image.

12

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

Test the slicers and note that only the data in the PivotTable is affected by them, the PivotChart
values are not filtered. Then clear the filters.

Right-click the Calendar Year slicer, click PivotTable Connections, select PivotTable2 and
PivotTable3, and then click OK. This associates the slicer with the two PivotChart charts.

Repeat the last step to connect the Country slicer to just the Sales Amount by Category by Year
PivotChart chart (PivotTable2).

Test the slicers. The Calendar Year slicer should filter the PivotTable and both PivotCharts, while the
Country slicer should filter only the PivotTable and the Sales Amount by Category by Year
PivotChart.

Clear the filters, and then save the Sales Overview.xlsx workbook and close it.

Results: After this exercise, you should have created a worksheet that contains two PivotChart charts, a
PivotTable table, and two slicers.

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

Exercise 3: Sharing a PowerPivot Workbook to PowerPivot Gallery


Scenario
Having tested the PowerPivot for Excel add-in, you now want to test PowerPivot for SharePoint.
The main tasks for this exercise are as follows:
1.

Upload a PowerPivot for Excel workbook to PowerPivot Gallery.

2.

Open a PowerPivot for Excel workbook from PowerPivot Gallery.

Task 1: Upload a PowerPivot for Excel workbook to PowerPivot Gallery

Open Internet Explorer and on the Adventure Works Portal - Home webpage at http://mia-sqlbi,
view the PowerPivot Gallery library.

Upload the Sales Overview.xlsx workbook from the D:\10778A\Labfiles\Lab10\Starter folder. When
uploaded, the workbook should be displayed as shown here.

13

14

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

Task 2: Open a PowerPivot for Excel workbook from PowerPivot Gallery

Click the large icon for the Sales Overview.xlsx workbook in the gallery. It should be opened in Excel
Services as shown here.

Verify that the slicers still filter the data when used in Excel Services, and then close Internet Explorer.

Results: After this exercise, you should have uploaded a workbook to PowerPivot Gallery and browsed it
by using Internet Explorer and Excel.

Lab Instructions: Implementing a Tabular Data Model with Microsoft PowerPivot

15

Exercise 4: Using a PowerPivot Workbook as a Data Source


Scenario
Finally, you want to test how to use a PowerPivot for Excel workbook as a data source for Excel.
The main task for this exercise is as follows:

Connect to a PowerPivot workbook in PowerPivot Gallery and use it to create a PivotTable table in
Excel.

Task 1: Connect to a PowerPivot workbook in PowerPivot Gallery and use it to create


a PivotTable table in Excel

Start Microsoft Excel 2010, and in the new workbook, click the Data tab, on the ribbon, click Get
External Data, click From Other Sources, and then click From Analysis Services.

In the Data Connection Wizard dialog box, on the Connect to Database Server page, in the Server
name field, type http://localhost/PowerPivot Gallery/Sales Overview.xlsx, select Windows
authentication, and then click Next.

On the Select Database and Table page, select Model, and click Next, and then finish the Data
Connection wizard.

Import the data as a PivotTable Report to cell A1 in the existing worksheet.

In the PivotTable Field List, expand Reseller Sales if necessary, and then select Sum of Sales
Amount.

Expand Employee if necessary, select Last Name, and then review the data in the PivotTable table.

Close Microsoft Excel and dont save any changes. Close Internet Explorer.

Results: After this exercise, you should have created a connection to a PowerPivot workbook in
PowerPivot Gallery and used it to create a PivotTable table in Excel.

Lab Instructions: Introduction to DAX

Module 11
Lab Instructions: Introduction to DAX
Contents:
Exercise 1: Creating Calculated Columns

Exercise 2: Creating Measures

Exercise 3: Using Time Intelligence

Exercise 4: Creating a Dynamic Measure

11

Lab Instructions: Introduction to DAX

Lab: Creating Calculated Columns and Measures by Using


DAX

Exercise 1: Creating Calculated Columns


Scenario
Your users are now using PowerPivot and tabular databases to browse data. However, some users have
requested that you extend their tabular data models to enable them to explore sales by employee and
related manager. To do this, you will use DAX to create calculated columns and a new hierarchy.
The main tasks for this exercise are as follows:
1.

Prepare the lab environment.

2.

Create a calculated column by using concatenation.

3.

Create calculated columns to support parent-child relationships.

4.

Create a hierarchy that uses calculated columns.

5.

Create a PivotTable table that contains the Employees hierarchy.

Task 1: Prepare the lab environment

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab11\Starter
folder as Administrator.

Lab Instructions: Introduction to DAX

Task 2: Create a calculated column by using concatenation

In the D:\10778A\Labfiles\Lab11\Starter folder, open the Sales Overview.xlsx file.

Open the PowerPivot window, and in the Employee table, add a calculated column called Full Name
that uses the CONCATENATE function to concatenate the First Name and Last Name columns with a
space between them.

You can find the complete formula for this calculated column in the Module_11_Formulas.txt file in
the D:\10778A\Labfiles\Lab11\Starter folder.

The new column should look like this.

Task 3: Create calculated columns to support parent-child relationships

In the Employee table, add a new column named Path with the following DAX formula:
=PATH([EmployeeKey], [ParentEmployeeKey])

You can find the complete formulas for the calculated columns in this task in the
Module_11_Formulas.txt file in the D:\10778A\Labfiles\Lab11\Starter folder.

The Path calculated column should contain a set of employee keys for each row that defines the
employees position in the managerial hierarchy.

In the Employee table, add a new column called Employee Level 1.

In the formula bar above the Employee table, type the DAX formula in the following code sample,
and then press Enter.
=LOOKUPVALUE('Employee'[Full Name], 'Employee'[EmployeeKey], PATHITEM([Path], 1))

Lab Instructions: Introduction to DAX

The Employee Level 1 column should contain the full employee name that maps to the first
employee key for each row in the Path column.

Repeat the steps above to create the following columns

Employee Level 2: The full name that maps to the second employee key for each row in the
Path column.

Employee Level 3: The full name that maps to the third employee key for each row in the Path
column.

Employee Level 4: The full name that maps to the fourth employee key for each row in the Path
column.

The new columns should resemble this.

Right-click each of the five calculated columns that you created in this task in turn, and click Hide
from Client Tools.

Lab Instructions: Introduction to DAX

Task 4: Create a hierarchy that uses calculated columns

View the diagram for the data model, and add a hierarchy named Employees to the Employee table.
The hierarchy should include the Employee Level 1, Employee Level 2, Employee Level 3, and
Employee Level 4 columns as shown in the following image.

The hierarchy will display employees in order of seniority, with the most senior employees from the
Employee Level 1 column at the top.

Task 5: Create a PivotTable table that contains the Employees hierarchy

Switch to the Excel workbook and rename Sheet 2 to Employee Sales.

Add a PivotTable table to cell B1 in the Employee Sales worksheet.

Use the PivotTable to view the Sales Amount value from the Reseller Sales table by the Employees
hierarchy from the Employee table, as shown here.

Right-click the PivotTable and click Show/Hide Fields to hide the Employee Level 1 and Employee
Level 2 fields so that you can focus on the department heads and their subordinates.

Results: After this exercise, you should have a data model with a hierarchy based on DAX expressions.

Lab Instructions: Introduction to DAX

Exercise 2: Creating Measures


Scenario
Some users have requested that you extend their tabular data models to enable them to view the
percentage that each employee contributes to overall sales. To do this, you will use DAX to create the
required measures.
The main tasks for this exercise are as follows:
1.

Create a measure that calculates total sales for all employees.

2.

Create a measure that calculates percentage of sales per employee.

3.

Add conditional formatting to the PivotTable table.

Task 1: Create a measure that calculates total sales for all employees

In the Employee Sales worksheet you used in the previous exercise, add a new measure to the
Reseller Sales table in the PowerPivot Fields List pane. The new measure should be named Total
Sales for All Employees and should be based on the following formula and formatted as currency.
=CALCULATE([Sum of Sales Amount], ALL('Employee'))

You can find the complete formula for this measure in the Module_11_Formulas.txt file in the
D:\10778A\Labfiles\Lab11\Starter folder.
The measure settings for the new measure should look like this.

The CALCULATE function calculates the Sum of Sales Amount measure, and the ALL function
overrides the context of the Employee table, so that the measure delivers a single total regardless of
context. Remove this field from the PivotTableyou will reference it in another measure.

Lab Instructions: Introduction to DAX

Task 2: Create a measure that calculates percentage of sales per employee

In the Reseller Sales table, create another new measure named Percentage of Sales based on the
following DAX formula and formatted as a percentage.
=[Sum of Sales Amount]/[Total Sales for All Employees]

You can find the complete formula for this measure in the Module_11_Formulas.txt file in the
D:\10778A\Labfiles\Lab11\Starter folder.
The measure settings for the new measure should look like this.

The formula uses the Sum of Sales Amount and Total Sales for All Employees measures to
calculate the percentage of sales that each employee contributed, as shown here.

Lab Instructions: Introduction to DAX

Task 3: Add conditional formatting to the PivotTable table

In the Employees Sales worksheet, in the PivotTable table, expand all employees.

Select all of the rows in the Percentage of Sales column, but do not include the column header or
the Grand Total row value.

Click the Home tab. Add conditional formatting to the Percentage of Sales column. Use the Blue
Data Bar formatting option as shown here.

Save the Sales Overview.xlsx workbook when you have finished, and keep it open for the next
exercise.

Results: After this exercise, you should have created two measures.

Lab Instructions: Introduction to DAX

Exercise 3: Using Time Intelligence


Scenario
Some users have requested that you extend their tabular data models to enable them to view sales by
comparing them with the previous year. To do this, you will use a DAX time intelligence function to create
the required measures.
The main tasks for this exercise are as follows:
1.

Create a measure that uses a time intelligence function.

2.

Create a measure that uses conditional logic.

Task 1: Create a measure that uses a time intelligence function

In the Sales Overview.xlsx workbook, switch to the PowerPivot window, and if necessary, switch to
Data View.

View the Date table, and in the ribbon, on the Design tab, mark the Date table as Date Table, using
the FullDateAlternateKey column as the unique identifier. This enables PowerPivot to apply
temporal calculations to data in this table.

Switch back to the workbook and insert a PowerPivot PivotTable in a new worksheet, and then
rename the worksheet Year on Year Growth.

Add Calendar Year from the Date table to the Row Labels area and Sales Amount from the
Reseller Sales table to the Values area so that the PivotTable resembles the following image.

Add a new measure to the Reseller Sales table. The new measure should be named Previous Year
and should be based on the following formula and formatted as currency.
=CALCULATE([Sum of Sales Amount], DATEADD('Date'[FullDateAlternateKey], -1, YEAR))

You can find the complete formula for this measure in the Module_11_Formulas.txt file in the
D:\10778A\Labfiles\Lab11\Starter folder.

The Previous Year measure uses the CALCULATE function with the Sum of Sales Amount measure,
and the DATEADD function with the Date[FullDateAlternateKey] column to calculate sales amount
for one year earlier than the current year. Remove this field from the PivotTableyou will reference it
in another measure.

10

Lab Instructions: Introduction to DAX

Task 2: Create a measure that uses conditional logic

In the Reseller Sales table, create another new measure named Year on Year Growth based on the
following DAX formula and formatted as a percentage.
=IF([Previous Year], ([Sum of Sales Amount] [Previous Year])/[Previous Year],
BLANK())

You can find the complete formula for this measure in the Module_11_Formulas.txt file in the
D:\10778A\Labfiles\Lab11\Starter folder.
The Year on Year Growth formula uses the IF function to calculate year-on-year growth. The
Previous Year measure tests whether a previous year value exists, and calculates year-on-year
growth by using the Sum of Sales Amount and Previous Year measures. The measure returns a
BLANK value if there is no previous year value (which will always be the case for the first year in the
list), as shown here.

Save the Sales Overview.xlsx workbook when you have finished, and keep it open for the next
exercise.

Results: After this exercise, you should have created a measure that uses a time intelligence function to
calculate sales for the previous period, and a measure that uses conditional logic to calculate the growth
in sales from the previous period to the current period.

Lab Instructions: Introduction to DAX

11

Exercise 4: Creating a Dynamic Measure


Scenario
Some users have requested that you extend their tabular data models to enable them to view a PivotTable
table that displays appropriate values for each of these rows: Current Year, Previous Year, and YOY
Growth. To do this, you will use DAX to create a dynamic measure.
The main tasks for this exercise are as follows:
1.

Create a linked table.

2.

Create a measure that checks whether inputs have a single value.

3.

Create a measure that dynamically calculates values.

Task 1: Create a linked table

In the Sales Overview.xlsx workbook, click the Time Period worksheet tab.

Select cells A1 to A4, and on the PowerPivot tab, click Create Linked Table. Select the My table
has headers option.

In the PowerPivot window, rename the new table Time Period as shown here.

Task 2: Create a measure that checks whether inputs have a single value

Switch back to the workbook and insert a PowerPivot PivotTable in a new worksheet, and then
rename the worksheet Dynamic Time.

12

Lab Instructions: Introduction to DAX

Add the Period column from the Time Period table to the Row Labels area and Calendar Year
from the Date table to the Column Labels area so that the PivotTable resembles the following
image.

In the Reseller Sales table, create another new measure named Check Single Values based on the
following DAX formula as a TRUE/FALSE value.
=IF(HASONEVALUE('Time Period'[Period]) && HASONEVALUE('Date'[Calendar Year]), TRUE(),
FALSE())

You can find the complete formula for this measure in the Module_11_Formulas.txt file in the
D:\10778A\Labfiles\Lab11\Starter folder.

The Check Single Values measure uses the HASONEVALUE function to evaluate whether the Time
Period[Period] and Date[Calendar Year] inputs each contain one value for a given cell in the
PivotTable table. The IF function returns TRUE if they both return single values and FALSE if they do
not. Remove this field from the PivotTableyou will reference it in another measure

Task 3: Create a measure that dynamically calculates values

In the Reseller Sales table, create another new measure named Sales Over Time based on the
following DAX formula and formatted as currency.
=IF([Check Single Values], SWITCH(VALUES('Time Period'[Period]), "Current Year", [Sum
of Sales Amount], "Previous Year", [Previous Year], "YOY Growth",
IF(NOT(ISBLANK([Previous Year])), [Sum of Sales Amount] - [Previous Year], BLANK())),
BLANK())

You can find the complete formula for this measure in the Module_11_Formulas.txt file in the
D:\10778A\Labfiles\Lab11\Starter folder.
The Sales Over Time measure uses the SWITCH function to provide different calculations for each of
the values in the Period column (Current Year, Previous Year, and YOY Growth):

For the Current Year value, it uses the Sum of Sales Amount measure.

For the Previous Year value, it uses the Previous Year measure.

For the YOY Growth value, it subtracts the Previous Year measure from the Sum of Sales
Amount measure and uses the ISBLANK function to check for an empty Previous Year measure.

Lab Instructions: Introduction to DAX

The completed PivotTable should look like this.

Save the Sales Overview.xlsx workbook and close Excel.

Results: After this exercise, you should have created a dynamic measure

13

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Module 12
Lab Instructions: Implementing an Analysis Services Tabular
Data Model
Contents:
Exercise 1: Creating an Analysis Services Tabular Data Model Project
from a PowerPivot Workbook

Exercise 2: Implementing a Perspective

Exercise 3: Implementing Partitions

Exercise 4: Deploying an Analysis Services Tabular Data Model

10

Exercise 5: Enabling Access to a Tabular Data Model

11

Exercise 6: Configuring DirectQuery Storage Mode

12

Exercise 7: Implementing Security in a Tabular Data Model

15

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Lab: Working with an Analysis Services Tabular Data


Model

Exercise 1: Creating an Analysis Services Tabular Data Model Project from a


PowerPivot Workbook
Scenario
You have identified a heavily used PowerPivot for Excel workbook that you want to manage as a tabular
data model in Analysis Services.
The main tasks for this exercise are as follows:
1.

Prepare the lab environment.

2.

Review the Reseller Sales Analysis PowerPivot workbook.

3.

Create a tabular data model project by using SQL Server Data Tools.

4.

Set the impersonation account for the data connection.

5.

Explore the workspace database.

Task 1: Prepare the lab environment

Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab12\Starter
folder as Administrator.

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Task 2: Review the Reseller Sales Analysis PowerPivot workbook

In the D:\10778A\Labfiles\Lab12\Starter folder, open the Reseller Sales Analysis.xlsx Excel


workbook.

You will use the PowerPivot data model in this workbook to create an Analysis Services tabular data
model. Review the PowerPivot data model in the workbook and note that it contains no linked tables
(which would be incompatible with DirectQuery mode if this option was required later).

When you have reviewed the workbook, close it without saving any changes.

Task 3: Create a tabular data model project by using SQL Server Data Tools

Start SQL Server Data Tools and use the Import from PowerPivot project template to create a
project named Reseller Sales in the D:\10778A\Labfiles\Lab12\Starter folder.

If prompted, confirm that the workspace and deployment server is localhost\SQL2.

Import the metadata from the Reseller Sales Analysis workbook in the
D:\10778A\Labfiles\Lab12\Starter folder. The current impersonation settings in the workbook will not
allow you to import the data.

Task 4: Set the impersonation account for the data connection

In the model that has been created, edit the existing SqlServer MIA-SQLBI AdventureWorksDW
data connection and configure the impersonation settings to use the
ADVENTUREWORKS\ServiceAcct Windows user name with the password Pa$$w0rd.

Process the connection to import the data from the data source. After you have processed the
connection, model should resemble the following image.

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Task 5: Explore the workspace database

Use SQL Server Management Studio to explore the workspace database for the project that you
created in Task 3. This should be in the localhost\SQL2 instance of Analysis Services and should have
a name that begins Reseller Sales_Student as shown here.

Results: After this exercise, you should have created a tabular data model project.

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Exercise 2: Implementing a Perspective


Scenario
Users will need to be able to use the Reseller Sales tabular data model to view a number of measures,
including the sum of sales and product cost. Some users will need to aggregate the measures by all
dimensions, but others will not need to aggregate the data by employee-related dimensions or view
employee-related measures. To reduce the complexity of the model for these users, you plan to create a
perspective that does not include employee-related tables.
The main tasks for this exercise are as follows:
1.

Create measure calculations.

2.

Create a perspective.

3.

Test a perspective.

Task 1: Create measure calculations

In the Reseller Sales project, in the Reseller Sales table, create measure calculations that sum the
SalesAmount and TotalProductCost columns.

The easiest way to do this is to use the AutoSum feature. Click the column header of each column for
which you want to create a calculated measure, and then on the Column menu, point to AutoSum,
and click Sum.

After you have added the calculated measures, process all of the tables in the model. The model
should resemble the following image:

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Task 2: Create a perspective

Add a new perspective named No Employee Data to the model.

In the No Employee Data perspective, include all of the tables other than Employee and Sales
Quota. The perspective should resemble the following image.

Task 3: Test a perspective

Use the Analyze in Excel feature in the model designer to view the (Default) perspective in Microsoft
Excel as the current Windows user; and in the Excel PivotTable, view the sum of SalesAmount by
employee email address as shown in the following image.

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Close the Excel workbook, and then use the Analyze in Excel feature in the model designer to view
the No Employee Data perspective in Microsoft Excel as the current Windows user; and in the Excel
PivotTable, note that the Employee and Sales Quota tables are not available in this perspective.
Instead view the sum of SalesAmount by product category as shown in the following image.

Results: After this exercise, you should have created a perspective that does not include employee data.

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Exercise 3: Implementing Partitions


Scenario
The data in the Reseller Sales table changes often, so you need to update the Reseller Sales tabular data
model frequently to ensure that it remains up-to-date. To avoid reprocessing all of the data in the
Reseller Sales table every time you update, you intend to create partitions.
The main tasks for this exercise are as follows:
1.

Create partitions.

2.

View the partitions in the workspace database.

Task 1: Create partitions

In SQL Server Data Tools, create four new partitions named 2001, 2002, 2003, and 2004 in the
Reseller Sales table.

For each partition, use the Query Editor to modify the Transact-SQL statement so that it includes a
WHERE clause that filters the data in the partition to include only the data for orders that were placed
the appropriate year. For example, in the 2001 partition, use the following WHERE clause.
WHERE DATEPART(YEAR, OrderDate)=2001

Process the partitions to populate them, and check Partition Manager to view the processed
partitions.

Delete the original ResellerSales partition, which you no longer need. When you have finished, the
Partition Manager dialog box should resemble the following image:

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Task 2: View partitions in the workspace database

Use SQL Server Management Studio to examine the partitions in the workspace database as shown
here.

Results: After this exercise, you should have created and populated four partitions.

10

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Exercise 4: Deploying an Analysis Services Tabular Data Model


Scenario
The tabular data model is now ready for use, so you must deploy it to a server.
The main tasks for this exercise are as follows:
1.

Deploy the Reseller Sales project.

2.

View the deployed tabular database.

Task 1: Deploy the Reseller Sales project

Ensure that the project is configured to use the deployment server localhost\SQL2.

Deploy the project, entering the user name ADVENTUREWORKS\ServiceAcct and password
Pa$$w0rd if prompted.

Task 2: View the deployed tabular database

Use SQL Server Management Studio to explore the deployed Reseller Sales database in the
localhost\SQL2 instance of Analysis Services, as shown here.

View the physical files for the deployed database in the C:\Program Files\Microsoft SQL
Server\MSAS11.SQL2\OLAP\Data\Reseller Sales.0.db folder.

Results: After this exercise, you should have deployed the Reseller Sales project.

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Exercise 5: Enabling Access to a Tabular Data Model


Scenario
You want to provide access to the Reseller Sales tabular data model, so that users can easily create an
Excel workbook based on it. To do this, you plan to create a BI Semantic Model Connection in the
PowerPivot Gallery document library of the companys internal SharePoint site.
The main tasks for this exercise are as follows:
1.

Enable the BI Semantic Model Connection content type

2.

Create a BI Semantic Model Connection.

3.

Use a BI Semantic Model Connection.

Task 1: Enable the BI Semantic Model Connection content type

In the Adventure Works Portal SharePoint site at http://mia-sqlbi, view the PowerPivot Gallery
document library.

View the library settings for this document library, and if the BI Semantic Model Connection
content type is not enabled for this document library, perform the following steps to add it.

In General Settings, click Advanced settings.

In Content Types, in the Allow management of content types? section, click Yes, and then
click OK.

On the Document Library Settings page, in the Content Types section, click Add from
existing site content types.

In the Select site content types from: list, click Business Intelligence.

In the Available Site Content Types list, click BI Semantic Model Connection, click Add, and
then click OK.

Task 2: Create a BI Semantic Model Connection

In PowerPivot Gallery, create a BI Semantic Model Connection that connects to the Reseller Sales
tabular data model that you deployed in Exercise 4.

Name the connection Reseller Sales Connection.

The tabular data model should have been deployed to the localhost\SQL2 server in a database
named Reseller Sales.

Task 3: Use a BI Semantic Model Connection

In PowerPivot Gallery, view the Reseller Sales Connection BI semantic mode connection, and
then create a new Excel workbook from it, enabling data access from Excel when prompted.

When prompted, select the Model in the data model (not the No Employee Data perspective)

In the new Excel document, use the PivotTable to view the sum of SalesAmount by
SalesTerritoryRegion.

Results: After this exercise, you should have created a BI Semantic Model Connection.

11

12

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Exercise 6: Configuring DirectQuery Storage Mode


Scenario
You want to test the Reseller Sales data model with the DirectQuery storage mode so that you can switch
to it if necessary as your data sets grow larger.
The main tasks for this exercise are as follows:
1.

Create a SQL Server Profiler trace.

2.

Test InMemory storage mode.

3.

Enable DirectQuery storage mode.

4.

Test DirectQuery storage mode

Task 1: Create a SQL Server Profiler trace

Start the SQL Server Profiler performance tool, and create a new trace for the localhost\SQL2
Analysis Services instance.

Name the trace BI Queries, and configure it to record the following events (you will need to select
the Show all events checkbox):

Query Begin

Query End.

Direct Query Begin

Direct Query End

VertiPaq SE Query Begin

VertiPaq SE Query End

Start the trace.

Task 2: Test InMemory storage mode

On the PowerPivot Gallery page in the http://mia-sqlbi SharePoint site, click the Create Power
View Report button for the the Reseller Sales Connection that you created in Exercise 5 as shown
here (note: you will explore Power View in more detail in the next module. In this exercise, you will
simply use it to generate some query activity).

Lab Instructions: Implementing an Analysis Services Tabular Data Model

13

Expand the Reseller Sales table and elect the Sales Amount field in to view the total sales amount in
the Power View report. Then minimize Internet Explorer.

Switch to SQL Server Profiler and review the entries in the SQL Server Profiler trace. Note that the
EventClass entries include Query Begin, VertiPaq SE Query Begin, VertiPaq SE Query End, and
Query End as shown here.

Task 3: Enable Direct Query storage mode

In SQL Server Management Studio, edit the properties of the Reseller Sales database in the
localhost\SQL2 instance of Analysis Services.

On the Database page of the Properties dialog box, in the General section, in the
DirectQueryMode list, enable DirectQuery as shown here.

14

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Task 4: Test Direct Query storage mode

Maximize Internet Explorer and in the list of fields, expand Product Category and click Category so
that he report now shows sales by product category. Then close Internet Explorer, leaving the Power
View page.

Switch to SQL Server Profiler and review the entries in the trace. Note that the EventClass entries now
include Query Begin, Direct Query Begin, Direct Query End, and Query End, as shown here.

Stop the trace and close SQL Server Profiler when you are finished.

Results: After this exercise, you should have enable DirectQuery storage mode.

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Exercise 7: Implementing Security in a Tabular Data Model


Scenario
To ensure that users can only view the data in the database that is relevant to them, you intend to set
row-level permissions that restrict access to sales data for specific regions only. Before you set row-level
permissions, you must disable DirectQuery storage mode.
The main tasks for this exercise are as follows:
1.

Disable DirectQuery storage mode.

2.

Create roles and apply database permissions.

3.

Apply row-level permissions.

4.

Test row-level permissions.

Task 1: Disable Direct Query storage mode

In SQL Server Management Studio, change storage mode for the Reseller Sales database in the
localhost\SQL2 Analysis Services instance back to InMemory.

Task 2: Create roles and apply database permissions

In SQL Server Data Tools, add six new roles named France, Germany, United Kingdom, United
States, Canada, and Australia to the model.

Grant the Read permission to each role. The Role Manager dialog box should resemble the
following image.

15

16

Lab Instructions: Implementing an Analysis Services Tabular Data Model

Task 3: Apply row-level permissions to roles

In the Role Manager dialog box, specify DAX filter expressions as row filters for the Sales Territory
table so that each role can only view data where the SalesTerritoryCountry field matches
appropriate country. For example, use the following expression for the Germany role.
=[SalesTerritoryCountry]="Germany"

The Role Manager dialog box should resemble the following image.

Task 4: Test row-level permissions

Use the Analyze in Excel feature in the model designer to view the (Default) perspective in Microsoft
Excel as France role.

In Excel, expand the Reseller Sales table and select the Sum of Sales Amount field. Then expand the
Sales Territory table and select the SalesTerritoryCountry field. Note that France is the only
country that is displayed as shown here.

Close Excel without saving any changes, and then close SQL Server Data Tools and any other
applications you have opened during this lab

Results: After this exercise, you should have created six roles and set and tested row-level permissions.

Lab Instructions: Creating Data Visualizations with Power View

Module 13
Lab Instructions: Creating Data Visualizations with Power
View
Contents:
Exercise 1: Configuring a Tabular Data Model for Power View

Exercise 2: Creating a Simple Power View Report

Exercise 3: Using Interactive Visualizations

Exercise 4: Creating a Scatter Chart and a Play Axis

Exercise 5: Exporting a Power View Report to Excel

10

Lab Instructions: Creating Data Visualizations with Power View

Lab: Creating Interactive Reports with Power View

Exercise 1: Configuring a Tabular Data Model for Power View


Scenario
You have created a tabular data model, which you intend to use to support Power View reports. You will
modify the model, deploy it, and then enable client access from PowerPivot Gallery.
The main tasks for this exercise are as follows:
1.

Prepare the lab environment.

2.

Define reporting properties.

3.

Deploy the project.

4.

Create a BI Semantic Model Connection.

Task 1: Prepare the lab environment

Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab13\Starter
folder as Administrator.

Lab Instructions: Creating Data Visualizations with Power View

Task 2: Define reporting properties

In the D:\10778A\Labfiles\Mod13\Starter folder, open the Reseller and Internet Sales.sln tabular
data model project

In the Model.bim data model designer, set the following properties for the specified columns.
Table

Column

Property

Value

Product Category

Product Category

Default Label

True

Reseller Sales

Order Quantity

Summarize By

Sum

Internet Sales

Order Quantity

Summarize By

Sum

Date

Month

Sort by Column

MonthNumberOfYear

Task 3: Deploy the project

Deploy the Reseller and Internet Sales project. If you are prompted for impersonation credentials,
specify the user name ADVENTUREWORKS\ServiceAcct and the password Pa$$w0rd.

Task 4: Create a BI Semantic Model Connection

In the Adventure Works Portal SharePoint site at http://mia-sqlbi, view the PowerPivot Gallery
document library.

View the library settings for this document library, and if the BI Semantic Model Connection
content type is not enabled for this document library, perform the following steps to add it.

In General Settings, click Advanced settings.

In Content Types, in the Allow management of content types? section, click Yes, and then
click OK.

On the Document Library Settings page, in the Content Types section, click Add from
existing site content types.

In the Select site content types from: list, click Business Intelligence.

In the Available Site Content Types list, click BI Semantic Model Connection, click Add, and
then click OK.

In the PowerPivot Gallery document library, create a BI Semantic Model Connection that connects
to the Reseller and Internet Sales tabular data model that you deployed.

Name the connection Reseller and Internet Sales.

The tabular data model should have been deployed to the localhost\SQL2 server in a database
named Reseller and Internet Sales.

Results: After this exercise, you should have deployed the Reseller and Internet Sales tabular data
model, and created a BI Semantic Model connection that connects to it.

Lab Instructions: Creating Data Visualizations with Power View

Exercise 2: Creating a Simple Power View Report


Scenario
You want to visualize Internet sales data in the tabular data model by creating a Power View report.
The main tasks for this exercise are as follows:
1.

Create a Power View report.

2.

Add a Card visualization.

3.

Add a filter.

Task 1: Create a Power View report

Use the Reseller and Internet Sales BI Semantic Model Connection to create a report that shows
Internet Sales Total as a column chart with Calendar Year on the axis and Month as a series as
shown in the following image:

Modify the report to include vertical multiples that show a chart for each country in the Country
Region column in the Geography table as shown here.

Lab Instructions: Creating Data Visualizations with Power View

Task 2: Add a Card visualization

Resize the chart to create a blank space on the right of the View area.

Add a card visualization that displays Internet Sales Total for each category, with the default label
for each category. The report should look like the report in following image:

Task 3: Add a filter

Add a filter that filters by Product Category.

Test the filter by selecting only the Bikes and Clothing categories.

Results: After this exercise, you should have created a Power View report with a column chart, small
multiples, a card visualization, and a filter.

Lab Instructions: Creating Data Visualizations with Power View

Exercise 3: Using Interactive Visualizations


Scenario
You want to create an interactive report that enables viewers to see reseller sales by calendar year and
country with details about the sales volume and profitability for each product category.
The main tasks for this exercise are as follows:
1.

Create a new view.

2.

Create a report that contains tiles.

Task 1: Create a new view

Create a new view and add the title Reseller Sales by Calendar Year and Country.

Hide the filters area.

Task 2: Add tiles

Add the Product Category field from the Product Category table to the report, and then select the
Tiles visualization.

Resize the tile visualization, and then modify the Product Category table under the blue line to show:

Reseller Sales Total from the Reseller Sales table in the Values section.

Calendar Year from the Date table in the Axis section.

Country from the Sales Territory table in the Series section.

The report should resemble the following image:

Lab Instructions: Creating Data Visualizations with Power View

To the right of the bar chart, create a Card visualization that contains the Reseller Sales Total,
Reseller Profit, and Order Quantity fields.

Under the bar chart, add a column chart that shows Reseller Sales Total by employee Last Name.
Include a series that shows Calendar Year.
The completed report should resemble the following image.

Click each of the product category names in the navigation strip. Note that the visualizations update
to show data for the relevant category.

Results: After this exercise, you should have created a report that contains a tile visualization.

Lab Instructions: Creating Data Visualizations with Power View

Exercise 4: Creating a Scatter Chart and a Play Axis


Scenario
You want to explore how the relationship between sales, cost and profit for bikes has changed over time
by creating a report that contains a scatter chart with a play axis.
The main tasks for this exercise are as follows:
1.

Create a new view.

2.

Create a report that contains a scatter chart visualization.

Task 1: Create a new view

Create a new view titled Reseller Profit Over Time.

Task 2: Create a scatter chart

Add Reseller Sales Total to the canvas and select the Scatter Chart visualization. Then resize the
visualization to fill the available space.

In the Field List, add the following fields from the Fields Section to the relevant box in the Layout
Section:
Field Name

Add to Layout Section Box:

Total Product Cost

Y Value

Reseller Profit

Size

Product Subcategory

Details

Calendar Year

Play Axis

Add a filter to the report that filters by Product Category. Use the filter to display only the Bikes
category. The report should resemble the following image.

Lab Instructions: Creating Data Visualizations with Power View

Use the play axis to view the changes in sales data for the Bikes category over time.

Note that for Mountain Bikes and Road Bikes, Reseller Sales Total and Total Product Cost both
increase over time, before the Total Product Cost for Road Bikes starts to fall in 2003. When
Touring Bikes were first introduced, the Total Product Cost was high relative to the ResellerSales
Total value, but the Reseller Sales Total value rapidly increased over time, while the Total Product
Cost remained quite static over the same period.

Results: After this exercise, you should have created a report that contains a scatter chart with a play axis.

10

Lab Instructions: Creating Data Visualizations with Power View

Exercise 5: Exporting a Power View Report to Excel


Scenario
You have created a number of visualizations that you would like to present to the company executives. To
accomplish this, you plan to export the Power View report as a PowerPoint presentation.
The main tasks for this exercise are as follows:
1.

Save the report.

2.

View the presentation.

Task 1: Create a new view

Save the Power View report you have created in this lab as Sales Report.

Export the report to PowerPoint, saving the presentation as Sales Report.pptx in the
D:\10778A\Labfiles\Lab13\Starter folder. Then, close Internet Explorer

Task 2: View the presentation

Open the Sales Report.pptx presentation you exported in Microsoft PowerPoint 2010.

View the presentation as a slide show from the beginning. If a message warns you about a graphics
card issue, click OK.

Click to interact with each slide, and note that the interactive elements of Power View are available in
the PowerPoint presentation. To advance to the next slide, click outside of the main visualization
border, or right-click outside of the main visualization and click Next, or click the navigation buttons
at the bottom left of the slide as shown here.

Lab Instructions: Performing Predictive Analysis with Data Mining

Module 14
Lab Instructions: Performing Predictive Analysis with Data
Mining
Contents:
Exercise 1: Using Table Analysis Tools

Exercise 2: Creating a Data Mining Model

Exercise 3: Using the Data Mining Add-in for Excel to Modify


the Data Mining Structure

Exercise 4: Validating Data Mining Models

Exercise: Using a Data Mining Model in a Report

Lab Instructions: Performing Predictive Analysis with Data Mining

Lab: Using Data Mining to Support a Marketing Campaign

Exercise 1: Using Table Analysis Tools


Scenario
Marketing managers at Adventure Works want to create a mailing list that targets the individuals in their
data warehouse who are most likely to make a bike purchase. The first thing that you will is use the Data
Mining Add-in for Excel to identify the key factors that correlate with previous purchases of bikes by using
data from the data warehouse.
The main tasks for this exercise are as follows:
1.

Prepare the lab environment.

2.

Create a connection to Analysis Services.

3.

Use the Data Mining Add-in for Excel table analysis tools.

Task 1: Prepare the lab environment

Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIASQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

Run the Setup Windows Command Script file (Setup.cmd) in the D:\10778A\Labfiles\Lab14\Starter
folder as Administrator.

Lab Instructions: Performing Predictive Analysis with Data Mining

Task 2: Use the Data Mining add-in for Excel to create a connection to Analysis
Services

In the D:\10778A\Labfiles\Lab14\Starter folder, open the Customer Data For Data Mining.xlsx
workbook with Microsoft Excel.

On the ribbon, in the Table Tools group, click the Analyze tab, create a new connection the
DMAddinsDB catalog on the localhost server.

Task 3: Use the Data Mining add-in for Excel table analysis tools

Use the Analyze Key Influencers tool to identify the key influencers on purchasing a bike.

Use the Purchased Bike column as the column to analyze for key factors.

Include a discrimination report that compares the value Yes to the value No.
The report should resemble the following image:

Review the report, and then close the Excel, saving your changes.

Results: After this exercise, you should have created a Key Influencers report in Excel.

Lab Instructions: Performing Predictive Analysis with Data Mining

Exercise 2: Creating a Data Mining Model


Scenario
Now that you have an idea of the key influencers on bike purchasing, you want to create a data mining
model that will enable you to identify the individuals who are most likely to make a bike purchase. You
will use SQL Server Data Tools to create the model, and then deploy the model to Analysis Services.
The main tasks for this exercise are as follows:
1.

Create a data mining project.

2.

Create a data mining structure and a data mining model.

3.

Deploy the data mining model.

Task 1: Create a data mining project

Start SQL Server Data Tools, and create an Analysis Services multidimensional and data mining project
named AW Data Mining. Save the project in the D:\10778A\Labfiles\Lab14\Starter folder.

Create a data source named Adventure Works DW that connects to the AdventureWorksDW
database on the localhost Analysis Services instance. Use the credentials for the
ADVENTUREWORKS\Student user account with the password Pa$$w0rd to connect.

Use the Adventure Works DW data source to create a data source view named Adventure Works
DW DM View that includes the ProspectiveBuyer table and the vTargetMail view.

Task 2: Create a data mining structure and a data mining model

Use the Data Mining Wizard to create a data mining structure that uses the Microsoft Decision
Trees algorithm.

Specify the vTargetMail view from the Adventure Works DW DM View data view as the case table.

Configure the columns in the case table as follows:

BikeBuyer: Predictable

CustomerKey: Key

All other columns: Input

Have the wizard detect the content types and data types of the columns. Ensure that the content type
of the Bike Buyer column is identified as Discrete, and change the Yearly Income column to be
Discrete.

Create a testing set with 30% of the data.

Name the data mining structure Purchase Prediction, and name the data mining model Purchase
Decision Tree.

Task 3: Deploy the data mining model

Deploy the model to the localhost Analysis Services instance.

Results: After this exercise, you should have created a data mining structure and a data mining model.

Lab Instructions: Performing Predictive Analysis with Data Mining

Exercise 3: Using the Data Mining Add-in for Excel to Modify the Data
Mining Structure
Scenario
You want to create a second model in the Purchase Prediction data mining structure that uses the Naive
Bayes algorithm. You will use the Data Mining Add-in for Excel to create the new model and review it.
The main tasks for this exercise are as follows:
1.

Connect to the AW Data Mining model.

2.

Add a model to the data mining structure.

3.

Review the data mining model.

Task 1: Connect to the AW Data Mining model

Start Excel, and on the Data Mining tab of the ribbon, create a new connection to the AW Data
Mining database on the localhost Analysis Services instance.

Task 2: Add a model to the data mining structure

On the Data Mining tab of the ribbon, use the advanced data modeling support to add a model to
the structure.

Add the new model to the Purchase Prediction structure.

Use the Microsoft Naive Bayes algorithm.

Specify Bike Buyer as a Predict Only column and Customer Key column as a Key column, and
do not use the Age, Birth Date, Date First Purchase, Geography Key, or Name Style columns.
All remaining columns should be specified as Input columns.

Name the model Purchase Bayes, and select the options to process and browse it.

On the Finish page, click Finish.

Task 3: Review the data mining model

Review the data mining model by viewing the Dependency Network, Attribute Profiles, Attribute
Characteristics, and Attribute Discrimination tabs of the model browser.

Close the browser but keep Excel open for the next exercise.
Note In the Bike Buyer column, the value 1 indicates that the customer is a bike buyer,
and the value 0 indicates that the customer is not a bike buyer. When reviewing the Naive
Bayes data mining model, you will need to enter the correct values for the Bike Buyer
column on the Attribute Characteristics tab, and the Attribute Discrimination tab.

Results: After this exercise, you should have created a Naive Bayes data mining model.

Lab Instructions: Performing Predictive Analysis with Data Mining

Exercise 4: Validating Data Mining Models


Scenario
Now that you have created the data mining models, you want to validate them to see which is the most
accurate for your data. You will use the Data Mining Add-in for Excel to validate the models.
The main tasks for this exercise are as follows:
1.

Use the Accuracy Chart wizard.

2.

Use the Classification Matrix wizard.

3.

Use the Profit Chart wizard.

Task 1: Use the Accuracy Chart wizard

Use the Data Mining tools in Excel to view an accuracy chart for the Purchase Prediction data
mining structure. The chart should show accuracy for predicting a Bike Buyer value of 1 from the test
data in the mining structure.

Review the accuracy chart to determine the relative accuracies of each model when used to predict
bike buyers in a given population of prospective customers.

Task 2: Use the Classification Matrix wizard

Use the Data Mining tools in Excel to view a classification matrix for the Purchase Prediction data
mining structure. The matrix should show percentages of correct and incorrect predictions of a Bike
Buyer value from the test data in the mining structure.

Review the classification matrix to determine how often the mining models correctly predicted a
value of 1 or 0 for the Bike Buyer column when compared to the test data.

Task 3: Use the Profit Chart wizard

Use the Data Mining tools in Excel to view a profit chart for the Purchase Prediction data mining
structure. The chart should show the estimated profit generated by each model when predicting a
Bike Buyer value of 1 for a target population of 5000 with a fixed cost of 500.00, and individual cost
of 1.00, and a revenue per individual of 150.00 when using the test data in the mining structure.

Review the profit chart to determine predicted profitability for each model.

Save the workbook as DM Validation.xlsx.

Results: After this exercise, you should have validated the data mining models by using the Data Mining
Add-in for Excel.

Lab Instructions: Performing Predictive Analysis with Data Mining

Exercise 5: Using a Data Mining Model in a Report


Scenario
Now that you have validated the data mining models, you want to create a report that contains the list of
potential bike purchasers listed from most likely to purchase to least likely. You will create a Reporting
Services report that uses data from the AW Data Mining database and then format the report.
The main tasks for this exercise are as follows:

Create a report.

Task 1: Create a report

Use SQL Server Data Tools to create a new project by using the Report Server Project Wizard.

Name the project Promotion Targeting.

Create a new data source for the AW Data Mining database in the localhost instance of
Microsoft SQL Server Analysis Services.

Use the query builder to create a query that uses the Purchase Bayes model and the
ProspectiveBuyer(dbo) case table. Configure the query to return the following fields.
Source

Field

ProspectiveBuyer

FirstName

ProspectiveBuyer

LastName

ProspectiveBuyer

Address Line 1

ProspectiveBuyer

City

Purchase Bayes

Bike Buyer

Prediction Function

PredictProbability

Alias

Criteria/Argument

=1
Purchase Probability

[Purchase - Bayes].[Bike Buyer]

Create a tabular report with all fields in the details section and format it using any style, and
name it Potential Bike Buyers.

Sort the report from Z to A by the Purchase Probability column and change the format of the
Purchase Probability column to percentage.

Review the Potential Bike Buyers report. It should resemble the following image.

Results: After this exercise, you should have created a report that predicts bike purchasers.

Lab Answer Key : Introduction to Business Intelligence and Data Modeling

Module 1
Lab Answer Key : Introduction to Business Intelligence and
Data Modeling
Contents:
Exercise 1: Exploring a Reporting Services Report

Exercise 2: Exploring a PowerPivot Workbook

Exercise 2: Exploring a Power View Report

Lab Answer Key : Introduction to Business Intelligence and Data Modeling

Lab 1: Reporting and Analyzing Data


Exercise 1: Exploring a Reporting Services Report
Task 1: Prepare the lab environment
1.

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to
MIA-SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab01, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab01\Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd), and then click Run as
administrator.

5.

Click Yes when prompted to confirm that you want to run the command file, and then wait for the
script to finish.

Task 2: Publish and view a Reporting Services report


1.

Start Internet Explorer and browse to the http://mia-sqlbi SharePoint site.

1.

In the Libraries section of the Quick Launch pane on the left of the site, click Reports.

2.

On the Documents tab of the ribbon, click New Document and then click Report Builder Report. If
prompted to install Report Builder, click Run and wait for the application to be downloaded and
installed.

3.

In the Getting Started window, click Open. Then browse to the


D:\10778A\Labfiles\Lab01\Starter\AWReports folder and open the Sales_Report.rdl report.

4.

Click the round button at the top left of the Report Builder window, and click Save As. Then click the
Recent Sites and Servers shortcut, double-click http://mia-sqlbi/, double-click Reports, and click
Save.

5.

Close Report Builder, and in Internet Explorer, in the Libraries section of the Quick Launch area, click
Reports to refresh the view.

6.

Click the Sales_Report report, and note that it shows a chart of sales for 2004.

7.

At the top of the report page, click the Next Page button and note that this page shows sales details
for January. Each subsequent page shows sales for the remaining months of the year.

8.

In the Year parameter list, uncheck 2004, check 2001, and then click Apply. Note that the report
now shows sales for 2001.

9.

On the Actions menu bar, click Export, and then click Excel. When prompted, click Open and then
when the file has downloaded, click Open again to open the report in Excel.

10. In Excel, click Enable Editing, and view the worksheets in the workbook. Then close Excel without
saving any changes and close Internet Explorer.

Lab Answer Key : Introduction to Business Intelligence and Data Modeling

Exercise 2: Exploring a PowerPivot Workbook


Task 1: Open and review a PowerPivot for Excel workbook
1.

In the D:\10778A\Labfiles\Lab01\Starter folder, double-click AW Sales.xlsx.

2.

Click the Reseller Sales tab. This worksheet contains a PivotTable table that displays the Sales
Amount, Product Cost, and Total Profit measures, a PivotChart chart called Sales Amount by
Category by Year, and two slicers called Country and Calendar Year.

3.

In the PivotTable table, expand Bikes. Note that the values in the Sales Amount, Product Cost, and
Total Profit columns update automatically to show the data for the Bikes category. Note that the
color-coded conditional formatting in the Total Profit column displays a different color for each of
the bike categories. The color that is displayed for a given category depends on the value in the Total
Profit column for that category.

4.

Expand Mountain Bikes and review the data for the different products in the Mountain Bikes
subcategory.

5.

Review the data in the Sales Amount by Category by Year PivotChart chart.

6.

In the Country slicer, click United Kingdom. Note that the data in the PivotTable table and the
PivotChart chart updates to show only the sales figures for the United Kingdom.

7.

In the Calendar Year slicer, click 2004. Note that the data in the PivotTable table and the PivotChart
chart updates to show only the sales figures for 2004.

8.

In the Calendar Year slicer and the Country slicer, click the Clear Filter button.

9.

Close the PowerPivot window, and then close Excel without saving any changes.

Task 2: Upload a PowerPivot for Excel workbook to PowerPivot Gallery


1.

Start Internet Explorer and browse to the http://mia-sqlbi SharePoint site.

2.

In the Libraries list, click PowerPivot Gallery.

3.

Click the Documents tab, click the Upload Document drop-down menu, and then click Upload
Document.

4.

In the PowerPivot Gallery Upload Document dialog box, click Browse.

5.

In the File name box, navigate to the D:\10778A\Labfiles\Lab01\Starter\ folder, click


AW Sales.xlsx, and then click Open.

6.

In the PowerPivot Gallery Upload Document dialog box, click OK.

7.

If the PowerPivot Gallery AW Sales.xlsx dialog box appears, click Save.

Lab Answer Key : Introduction to Business Intelligence and Data Modeling

Task 3: Open a PowerPivot for Excel workbook from PowerPivot Gallery


1.

In the PowerPivot Gallery, click the large AW Sales icon.

2.

Click the Reseller Sales tab, and then use the Calendar Year and Country slicers to modify the data
that is displayed in the PivotTable table and PivotChart charts.

3.

Clear the Calendar Year and Country slicer filters.

4.

In the breadcrumb trail at the top of the page, click PowerPivot Gallery to close the workbook.

5.

Keep Internet Explorer open for the next exercise.

Lab Answer Key : Introduction to Business Intelligence and Data Modeling

Exercise 3: Exploring a Power View Report


Task 1: Open a Power View report and create a column chart
1.

In the PowerPivot Gallery, to the right of AW Sales, click Create Power View Report.

2.

In the Field List, in the Fields Section, expand Reseller Sales, and then select Sales Amount.

3.

On the Design tab, in the Visualizations gallery, click Column.

4.

Pause the pointer on the lower-right corner of the chart, and then drag the chart to enlarge it.

5.

In the Field List, in the Fields Section, expand Date, and then select Calendar Year.

6.

In the Field List, in the Fields Section, expand Product, and then select Category.

7.

Drag the bottom right corner of the column chart to make it larger.

8.

In the chart, in the Category series, click Clothing. The chart highlights the figures for the Clothing
category. Click Clothing again to display the figures for every category.

9.

In the Field List, in the Fields Section, in Date, select Month. This displays multiple charts, one for
each month of the year.

10. Close Windows Internet Explorer. In the Windows Internet Explorer dialog box, click Leave this
page.

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

Module 2
Lab Answer Key: Implementing Reports with SQL Server
Reporting Services
Contents:
Lab 2A: Creating a Report with Report Designer
Exercise 1: Creating a Report

Exercise 2: Grouping and Aggregating Data

Lab 2B: Enhancing and Publishing a Report


Exercise 1: Adding a Chart to a Report

Exercise 2: Adding Parameters to a Report

10

Exercise 3: Publishing a Report

12

Optional Exercise: Using Data Bars and Sparklines

13

Optional Exercise: Using a Map

15

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

Lab 2A: Creating a Report with Report


Designer
Exercise 1: Creating a Report
Task 1: Prepare the lab environment
1.

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to
MIA-SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab02A, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab02A\Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd) and click Run as administrator.

5.

Click Yes when prompted to confirm you want to run the command file, and wait for the script to
finish.

Task 2: Create a Report Server project


1.

Click Start, click All Programs, click Microsoft SQL Server 2012 RC0, and click SQL Server Data
Tools. Then wait for the Visual Studio environment to load.

2.

In Visual Studio, on the File menu, point to New and click Project.

3.

In the New Project dialog box, select Report Server Project. Then specify the following project
properties and click OK:

Name: AWReports

Location: D:\10778A\Labfiles\Lab02A\Starter\Ex1

Create directory for solution: Not selected

Task 3: Add a report to the project


1.

In the Solution Explorer pane, right-click the Reports folder and click Add New Report.
Note If the Solution Explorer pane is not visible, on the View menu, click Solution
Explorer.

2.

In the Welcome to the Report Wizard page of the Report Wizard, click Next.

3.

In the Select the Data Source page, enter the following information and click Next:

Name: AdventureWorksDW

Type: Microsoft SQL Server

Connection String: Data Source=localhost;Initial Catalog=AdventureWorksDW

Make this a shared data source: Not selected

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

4.

In the Design the Query page, click Query Builder. Then in the Query Designer window, click
Import, select the Sales Query Transact-SQL script file in the D:\10778A\Labfiles\Lab02A\Starter\Ex1
folder, and click Open.

5.

In the Query Designer window, on the toolbar, click Run. Then view the results of the query in the
bottom pane of the Query Designer window. This is the data for the sales report.

6.

In the Query Designer window, click OK, and in the Design the Query page of the Report Wizard,
click Next.

7.

In the Select the Report Type page, select Tabular and click Next.

8.

In the Design the Table page, click Year, and then while holding the Ctrl key, click Month,
ProductCategory, ProductSubcategory, Product, SalesOrderNumber, OrderDate, and
SalesAmount. Then click Details to add these fields to the details group of the report, and click
Next.

9.

In the Choose the Table Style page, view each of the available styles, and then select Generic and
click Next.

10. In the Completing the Wizard page, change the report name to Sales Report, and click Finish.

Task 4: Explore and modify report properties


1.

In the Report Data pane, expand Data Sources.


Note

If the Report Data pane is not visible, on the View menu, click Report Data.

2.

Right-click the AdventureWorksDW data source and click Data Source Properties. Then view the
properties of the data source and click Cancel.

3.

In the Report Data pane, expand the Datasets folder. Then right-click Dataset1 and click Dataset
Properties.

4.

In the Dataset Properties dialog box, change the dataset name to Sales, and click OK.

5.

In the Report Designer, view the Row Groups pane at the bottom and note that the report contains a
single row group named table1_Details_Group. Right-click table1_Details_Group and click Group
Properties.

6.

In the Group Properties dialog box, on the General tab, change the name to SalesDetails. Then
click OK.

Task 5: Format the report


1.

In the Report Designer, click the Preview tab and view the report. Note that the report contains no
formatting.

2.

In the Report Designer, click the Design tab, and then click in any blank space in the Report designer
pane to ensure no report elements are selected. Note that the report contains two elements: a
textbox containing the report title, and a table containing the report data.

3.

Click the textbox containing the report title (Sales Report) and use the formatting buttons on the
toolbar to increase its size to 14pt and make it bold.

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

4.

Click the table containing the report data, so that the gray column and row headers are displayed,
and then click the gray cell where the column headers and row headers intersect to select the table.
When the table is selected, click and drag its selection handle (a small square containing four
directional arrows) to move the table down about a centimeter.

5.

Select the title textbox and resize it to ensure the title is completely visible.

6.

Click the table containing the report data, so that the gray column and row headers are displayed,
and click the row header for the first row (which contains the column titles). Then use the formatting
buttons on the toolbar to make the column titles bold, change the background color to light gray,
and align the column titles to the left.

7.

Click the row header for the details row and use the formatting buttons on the toolbar to align the
cells to the left.

8.

Right-click the OrderDate detail cell and click Text Box Properties; and on the Number tab, select
the Date category and the 31-Jan-00 format. Then click OK.

9.

Right-click the SalesAmount detail cell and click Text Box Properties; and on the Number tab,
select the Currency category, specify 2 decimal places, select Use 1000 separator, and select the
($12,345.00) format. Then click OK.

10. Drag the borders of the column headings to resize the columns so that the values in the table fit
them. Switch back and forth between the Preview and Design tabs to ensure check your work.

Task 6: Export the report to Microsoft Excel


1.

In the Report Designer, click the Preview tab and view the report.

2.

On the report toolbar, click Export and click Excel. Then in the Save As dialog box, browse to the
D:\10778A\Labfiles\Lab02A\Starter\Ex1 folder and click Save.

3.

Close SQL Server Data Tools, saving your work if prompted.

4.

View the contents of the D:\10778A\Labfiles\Lab02A\Starter\Ex1 folder, and then double-click the
Sales Report Microsoft Excel workbook to open it in Excel.

5.

View the report, and then close Excel without saving any changes.

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

Exercise 2: Grouping and Aggregating Data


Task 1: Open the AWReports project
1.

View the contents of the D:\10778A\Labfiles\Lab02A\Starter\Ex2 folder, and then double-click the
AWReports Visual Studio project to open it in SQL Server Data Tools.

2.

In Solution Explorer, double-click Sales Report.rdl to open it in Report Designer.

Task 2: Delete the Year column and titles row


1.

Click the table in the report so that the gray column and row headers are displayed, and then click
the column header for the Year column to select it.

2.

Right-click the selected Year column header, and click Delete Columns.

3.

Click the gray row heading for the first row (which contains the column titles) to select it.

4.

Right-click the selected row header, and click Delete Rows.

Task 3: Group the report by Month


1.

In the Groupings pane, select the SalesDetails group.

2.

Right-click the selected group, point to Add Group, and click Parent Group.

3.

In the Tablix group dialog box, in the Group by list, select [Month]. Then select Add group header
and click OK.

4.

Click the Preview tab to view the report and note that a new row and column have been added to
the report, and that the Month field is now displayed in both the Month group header and in the
details group.

5.

Click the Design tab, and then select the column containing the Month field in the details group,
and delete it.

6.

Click the Preview tab to view the report and note that the month grouping displays the data in
alphabetical order by month name (so the first month is April, followed by August, and so on).

7.

Click the Design tab, and in the Row Groups section of the Report Designer, click the drop-down
arrow for the Month group, and click Group Properties.

8.

In the Group Properties dialog box, on the Sorting tab, change the Sort by column to [MonthNo].
Then click OK.

9.

Click the Preview tab to view the report and note that the grouping now displays in calendar month
order (so the first month is January, followed by February, and so on).

Task 4: Add groups for Product Category, Product Subcategory, and Product
1.

Click the Design tab to view the report in design view.

2.

In the Row Groups section of the Report Designer, click the drop-down arrow for the SalesDetails
group, point to Add Group, and click Parent Group.

3.

In the Tablix group dialog box, in the Group by list, select [ProductCategory]. Then select Add
group header and click OK.

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

4.

Note that a new group header containing the ProductCategory field has been created, and that the
original ProductCategory column in the detail group still exists. Then select the column containing
the ProductCategory field in the details group, and delete it.

5.

Repeat the previous three steps to create groups for the [ProductSubcategory] and [Product] fields.

6.

Click the Preview tab and note that some group heading columns may not be wide enough to
display the field values. Then click the Design tab and adjust column widths accordingly.

Task 5: Add aggregate summary values


1.

In the Row Groups section of the Report Designer, click the drop-down arrow for the SalesDetails
group, point to Add Total, and click Before. Note that a total for the SalesAmount field is added to
the Product group header row.

2.

In the Row Groups section of the Report Designer, click the drop-down arrow for the Product
group, point to Add Total, and click Before. Note that a textbox with the heading Total and a total
for the SalesAmount field is added to the ProductSubcategory group header row.

3.

Repeat the previous step for the ProductSubcategory and ProductCategory groups.

4.

Click the Preview tab and note that the totals are calculated for each group.

5.

Click the Design tab and click the cell in the Product group heading row immediately above the
SalesOrderNumber field. Then right-click the selected cell and click Expression.

6.

In the Expression dialog box, in the Category pane, expand Common Functions and select
Aggregate. Then in the Item pane, double-click Count. Note that the expression value changes to
=Count(.

7.

In the Expression dialog box, in the Category pane, select Fields (Sales) and in the Item pane ensure
<All> is selected. Then in the Values pane, double-click SalesOrderNumber. Note that the
expression value changes to =Count(Fields!SalesOrderNumber.Value.

8.

Click in the textbox containing the incomplete expression value, and type ) to complete the
expression as =Count(Fields!SalesOrderNumber.Value). Then click OK.

9.

Right-click the cell containing the Count expression, and click Copy.

10. Right-click the cell immediately above the Count expression and click Paste to copy the expression
to the ProductSubcategory group heading row.
11. Repeat the previous step to copy the expression to the ProductCategory and Month group heading
rows.
12. Click the Preview tab and note that the Count expression is calculated for each group.

Task 6: Enable drilldown interactions


1.

Click the Design tab to view the report in design view.

2.

In the Row Groups section of the Report Designer, click the drop-down arrow for the SalesDetails
group and click Group Properties.

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

3.

On the Visibility tab; select Hide, select Display can be toggled by this report item, and in the
drop-down list, select Product1. Product1 is the textbox containing the Product group heading.
Then click OK.

4.

Repeat the previous two steps to hide the following groups:

5.

Product (toggled by ProductSubcategory1)

ProductSubcategory (toggled by ProductCategory1)

Click the Preview tab and note that you can expand and collapse the Product Category, Product
Subcategory, and Product groups.

Task 7: Add page breaks


1.

Click the Design tab to view the report in design view.

2.

Click anywhere on the report designer surface outside of the white body of the report, then in the
Properties pane, ensure the Report object is selected.
Note

If the Properties pane is not visible, on the View menu, click Properties Window.

3.

Set the InitialPageName property to Sales Summary.

4.

In the Row Groups section of the Report Designer, click the Month group; and in the Properties
pane, expand Group and expand PageBreak. Then set the BreakLocation property to Between.

5.

With the Month group still selected, click the drop-down arrow for the PageName property and
click Expression.

6.

In the Expression dialog box, in the Category pane, select Fields (Sales); in the Item pane ensure
<All> is selected, and in the Values pane, double-click Month. Verify that the expression matches the
code sample below, and then click OK.
=Fields!Month.Value

7.

In the Properties pane, in the drop-down list select the table1 Tablix object. Then expand
PageBreak and set the BreakLocation property to Start.

8.

Click the Preview tab and note that the first page of the report contains only the report title. Then
use the page navigation buttons to scroll through the pages of the report, noting that each month
starts on a new page.

9.

On the report toolbar, click Export and click Excel. Then in the Save As dialog box, browse to the
D:\10778A\Labfiles\Lab02A\Starter\Ex2 folder and click Save.

10. Close Visual Studio, saving your work if prompted.


11. View the contents of the D:\10778A\Labfiles\Lab02A\Starter\Ex2 folder, and then double-click the
Sales Report Microsoft Excel workbook to open it in Excel.
12. View the report, noting that the first sheet in the workbook is named Sales Summary, and that there
is an additional sheet for each months sales.
13. Click the January sheet and note that you can expand and collapse the Product Category, Product
Subcategory, and Product groups in Excel. Then close Excel without saving any changes.

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

Lab 2B: Enhancing and Publishing a Report


Exercise 1: Adding a Chart to a Report
Task 1: Prepare the lab environment
1.

Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to
MIA-SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab02B, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab02B\Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd) and click Run as administrator.

5.

Click Yes when prompted to confirm you want to run the command file, and wait for the script to
finish.

Task 2: Open the AWReports project


1.

View the contents of the D:\10778A\Labfiles\Lab02B\Starter\Ex1 folder, and then double-click the
AWReports Visual Studio project to open it in Visual Studio.

2.

In Solution Explorer, double-click Sales Report.rdl to open it in Report Designer.

Task 3: Add a Chart report item


1.

Click the table containing the report data, so that the gray column and row headers are displayed,
and then click the gray cell where the column headers and row headers intersect to select the table.
When the table is selected, click and drag its selection handle to move the table down about 10
centimeters.

2.

In the toolbox, click and drag the Chart component to the space you have created above the table.
Note

3.

In the Select Chart Type dialog box, select the 3D Clustered Column chart type. Then click OK.
Note
type.

4.

If the toolbox is not visible, on the View menu, click Toolbox.

Point the mouse over the chart icons to display a tooltip with name of the chart

Use the resize handles and selection handles to fit the chart into the space created when you moved
the table.

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

Task 4: Specify the data for the chart


1.

Click the chart area to select it, and then click inside the chart again to display the Chart Data editing
pane.

2.

In the Chart Data editing pane, in the Values section, click the Add field button (a yellow plus
symbol) and click SalesAmount.

3.

In the Category Groups section, click the drop-down button for the (Details) group and click
Month. Then in the Category Groups section, click the drop-down button for Month and click
Category Group Properties.

4.

In the Category Group Properties dialog box, on the Sorting tab, in the Sort by drop-down list,
select MonthNo. Then click OK.

5.

In the Chart Data editing pane, in the Series Groups section, click the Add field button and click
ProductCategory.

Task 5: Format the chart


1.

Click the chart area to select it, and then right-click inside the chart area again and click Chart
Properties.

2.

In the Chart Properties dialog box, in the Color palette drop-down list, select Semi transparent.
Then click OK.

3.

Right-click the Chart Title text box and click Delete Title.

4.

Right-click the vertical axis title and clear the Show Axis Title checkmark.

5.

Repeat the previous step to remove the horizontal axis title.

6.

Right-click any of the numbers in the vertical axis and click Vertical Axis Properties.

7.

In the Vertical Axis Properties dialog box, in the Number tab, select Currency. Then select Use
1000 separator and click OK.

8.

Click the Preview tab and note that the first page of the report contains the chart.

9.

On the report toolbar, click Export and click Excel. Then in the Save As dialog box, browse to the
D:\10778A\Labfiles\Lab02B\Starter\Ex1 folder and click Save.

10. Close Visual Studio, saving your work if prompted.


11. View the contents of the D:\10778A\Labfiles\Lab02B\Starter\Ex1 folder, and then double-click the
Sales Report Microsoft Excel workbook to open it in Excel.
12. View the report, noting that the first sheet in the workbook contains the chart as an image. Then
close Excel without saving any changes.

10

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

Exercise 2: Adding Parameters to a Report


Task 1: Open the AWReports project
1.

View the contents of the D:\10778A\Labfiles\Lab02B\Starter\Ex2 folder, and then double-click the
AWReports Visual Studio project to open it in Visual Studio.

2.

In Solution Explorer, double-click Sales Report.rdl to open it in Report Designer.

Task 2: Add a parameter


1.

In the Report Data pane, expand the Datasets folder. Then right-click Sales and click Dataset
Properties.

2.

In the Dataset Properties dialog box, under the Query textbox, click Import and browse to
D:\10778A\Labfiles\Lab02B\Starter\Ex2. Then select Parameterized Sales Query and click Open.
Note The new query is exactly the same as before except for the addition of a WHERE
clause that includes a @Year parameter.

3.

In the Dataset Properties dialog box, click OK.

4.

In the Report Data pane, expand Parameters and then right-click the Year parameter and click
Parameter Properties.

5.

On the General tab, in the data type drop-down list, select Integer, and select Allow multiple
values. Then click OK.

6.

In the Report Data pane, right-click the Sales dataset and click Dataset Properties; and then on the
Parameters tab, note that the @Year dataset parameter is mapped to the @Year report parameter.
Then click Cancel.

7.

Right-click the report title (Sales Report) and click Expression.

8.

In the Expression dialog box, in the Set expression for: Value box, change the expression to the
following code and then click OK:
="Sales Report for " & Join(Parameters!Year.Value, ", ")

9.

Click the Preview tab.

10. In the Year drop down list, type 2003. Then click View Report. The sales for 2003 are included in the
report.
11. In the Year drop down list, after 2003 insert a new line and type 2004. Then click View Report. The
sales for 2003 and 2004 are included in the report.

Task 3: Configure available and default values for a parameter


1.

Click the Design tab to view the report in design view.

2.

In the Report Data pane, right-click the Datasets folder, and click Add Dataset.

3.

In the Dataset Properties dialog box, change the Name to SalesYears, and select Use a dataset
embedded in my report.

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

11

4.

In the Data source drop-down list, select AdventureWorksDW. Then under the Query textbox, click
Import, browse to D:\10778A\Labfiles\Lab02B\Starter\Ex2, select Sales Years, and click Open.

5.

View the query, noting that it returns all years for which there have been Internet sales, and then in
the Dataset Properties dialog box, click OK.

6.

In the Report Data pane, right-click the Datasets folder, and click Add Dataset.

7.

In the Dataset Properties dialog box, change the Name to MaxYear, and select Use a dataset
embedded in my report.

8.

In the Data source drop-down list, select AdventureWorksDW. Then under the Query textbox, click
Import, browse to D:\10778A\Labfiles\Lab02B\Starter\Ex2, select Max Year, and click Open.

9.

View the query, noting that it returns the year of the most recent Internet sales order, and then in the
Dataset Properties dialog box, click OK.

10. In the Report Data pane, expand Parameters and then right-click the Year parameter and click
Parameter Properties.
11. In the Parameter Properties dialog box, in the Available Values tab, select Get values from a
query. Then in the Dataset drop-down list, select SalesYears; in the Value field drop-down list,
select Year; and in the Label field drop-down list, select Year.
12. In the Parameter Properties dialog box, in the Default Values tab, select Get values from a query.
Then in the Dataset drop-down list, select MaxYear; and in the Value field drop-down list, select
MaxYear. Then click OK.
13. Click the Preview tab, and note that the report is displayed using the default parameter value for the
most recent year (which is 2004).
14. Click the Year drop-down list and note that it contains a list of years for which there have been sales.
15. Close Visual Studio, saving your work if prompted.

12

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

Exercise 3: Publishing a Report


Task 1: Open the AWReports project
1.

View the contents of the D:\10778A\Labfiles\Lab02B\Starter\Ex3 folder, and then double-click the
AWReports Visual Studio project to open it in Visual Studio.

2.

In Solution Explorer, double-click Sales Report.rdl to open it in Report Designer.

Task 2: Configure deployment properties


1.

In the Solution Explorer pane, right-click AWReports and click Properties.

2.

In the AWReports Property Pages dialog box, set the following property values, and then click OK:

OverwriteDatasets: True

OverwriteDataSources: True

TargetDatasetFolder: http://mia-sqlbi/Reports/Datasets

TargetDataSourceFolder: http://mia-sqlbi/Reports/Data Sources

TargetReportFolder: http://mia-sqlbi/Reports

TargetReportPartFolder: http://mia-sqlbi/Reports/Report Parts

TargetServerURL: http://mia-sqlbi

TargetServerVersion: SQL Server 2008 R2 or later

Task 3: Deploy the AWReports project


1.

On the Build menu, click Deploy AWReports.

2.

When deployment has succeeded, close Visual Studio, saving your changes if prompted. Then start
Internet Explorer and view the SharePoint site at http://mia-sqlbi.

3.

In the Quick Launch area, under Libraries, click Reports.

4.

In the Reports library, click Sales Report and note that the report is displayed with the default
parameter value.

5.

On the Actions menu, point to Export and click Excel.

6.

When prompted, click Save, and save the report as Sales_Report.xlsx in the
D:\10778A\Labfiles\Lab02B\Starter\Ex3 folder.
Note

The export process can take a minute or so.

7.

Wait for the file to be downloaded, then when the download is complete, click Open.

8.

View the report in Excel, and then close Excel.

9.

Close Internet Explorer.

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

13

Optional Exercise: Using Data Bars and Sparklines


Task 1: Open the AWReports project
1.

View the contents of the D:\10778A\Labfiles\Lab02B\Starter\Opt1 folder, and then double-click the
AWReports Visual Studio project to open it in SQL Server Data Tools.

2.

In Solution Explorer, double-click Sales Trends.rdl to open it in Report Designer.

3.

Click the Preview tab and view the report, noting that it shows sales in a specified year broken down
by category and month.

Task 2: Add a data bar


1.

Click the Design tab.

2.

In the tablix data region, click the cell to the right of the cell containing the [ProductCategory] field
and above the cell containing the [EnglishMonthName] field, and type Sales Volume: Then format
the Sales Volume: cell as italic.

3.

.In the toolbox, drag a Data Bar item and drop it in the cell to the right of the Sales Volume cell.
Then, in the Select Data Bar Type dialog box, select the first style in the Data Bar section (Bar) and
click OK.

4.

Click the data bar you just added to display the Chart Data pane, and then in the Values section, add
the SalesAmount field.

5.

In the Chart Data pane, in the Values section, click the drop-down arrow next to the SalesAmount
field and click Series Properties. Then, in the Series Properties dialog box, on the Fill tab, set the
following options and click OK.

Fill style: Gradient

Color: Light Steel Blue

Secondary color: Cornflower Blue

Gradient Style: Left right

6.

In the Chart Data pane, in the Values section, click the drop-down arrow next to the SalesAmount
field and click Horizontal Axis Properties. Then, in the Horizontal Axis Properties dialog box,
verify that the Align axes in checkbox is checked and table1 is selected, and click OK.

7.

Click the report design surface to hide the Chart Data pane, and then click the cell containing the
data bar to select it. Then, in the toolbar, click the border drop-down list and select No Border.

8.

Click the Preview tab and verify that your report shows a data bar that indicates the relative sales
volume for each product category.

Task 3: Add a spark line


1.

Click the Design tab.

2.

In the tablix data region, click the cell to the right of the cell containing the data bar, and type
Monthly Trend:. Then format the Monthly Trend cell as italic.

3.

In the toolbox, drag a Sparkline item and drop it in the cell to the right of the Monthly Trend cell.
Then, in the Select Sparkline Type dialog box, select the second style in the Area section (Smooth
Area) and click OK.

14

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

4.

Click the sparkline you just added to display the Chart Data pane, and then in the Values section, add
the SalesAmount field. Then in the Category Groups section, click the drop-down arrow for the
Details group and select MonthNumberOfYear.

5.

In the Chart Data pane, in the Values section, click the drop-down arrow next to the SalesAmount
field and click Series Properties. Then, in the Series Properties dialog box, on the Fill tab, set the
following options and click OK:

Fill style: Gradient

Color: Light Steel Blue

Secondary color: Cornflower Blue

Gradient Style: Top bottom

6.

In the Chart Data pane, in the Values section, click the drop-down arrow next to the SalesAmount
field and click Horizontal Axis Properties. Then, in the Horizontal Axis Properties dialog box,
check Align axes in, ensure table1 is selected, and click OK.

7.

In the Chart Data pane, in the Values section, click the drop-down arrow next to the SalesAmount
field and click Vertical Axis Properties. Then, in the Vertical Axis Properties dialog box, check
Align axes in, ensure table1 is selected, and click OK.

8.

Click the report design surface to hide the Chart Data pane, and then click the cell containing the
sparkline to select it. Then, in the toolbar, click the border drop-down list and select No Border.

9.

Click the Preview tab and verify that your report shows a sparkline that indicates the relative monthly
sales volume for each product category.

10. Close SQL Server Data Tools.

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

15

Optional Exercise: Using a Map


Task 1: Open the AWReports project
1.

View the contents of the D:\10778A\Labfiles\Lab02B\Starter\Opt2 folder, and then double-click the
AWReports Visual Studio project to open it in SQL Server Data Tools.

2.

In Solution Explorer, double-click US Sales By State.rdl to open it in Report Designer.

3.

Click the Preview tab and view the report, noting that it shows sales in a specified year for each state.

Task 2: Add a map


1.

Click the Design tab.

2.

In the toolbox, drag a Map item and drop it in the report body to the right of the existing tablix data
region. Then complete the New Map Layer wizard using the following settings:

On the Choose a source of spatial data, ensure Map gallery is selected and in the Map Gallery
pane, select USA by State Insert. Then click Next.

On the Choose spatial data and map view options page, review the default settings and click
Next.

On the Choose map visualization page, select Color Analytical Map and click Next.

On the Choose the analytical dataset page, select Sales and click Next.

On the Specify the match fields for spatial and analytical data page, select the checkbox for
the STATENAME field, and in the Analytical Data Fields column, select StateProvinceName.
Then click Next.

On the Choose color theme and data visualization page, in the Theme drop-down list, select
Ocean; in the Field to visualize drop-down list, select [Sum(SalesTotal)]; and in the Color rule
drop-down list, select White-Blue. Then click Finish.

Task 3: Format the map


1.

Click the map to display the Map Layers pane is displayed (you might need to scroll to the right to
see the Map Layers pane). Then, in the Map Layers pane, click the drop-down arrow for the
PolygonLayer1 layer and click Polygon Properties.

2.

In the Map Polygon Properties dialog box, on the General tab, in the Tooltip drop-down list, select
[Sum(SalesTotal)]. Then click OK.

3.

In the Map Layers pane, click the drop-down arrow for the PolygonLayer1 layer and click Polygon
Color Rule.

4.

In the Map Color Rules Properties dialog box:


1.

On the General tab, note that the data is visualized by using color ranges from white to blue.
Then, on the Distribution tab, set the Number of subranges to 10 and the Range start to 0,
and then click OK.

2.

Right-click the Title text box above the legend, and click Legend Title Properties. Then in the
Map Legend Title Properties dialog box, change the title text to Sales ($) and click OK.

16

Lab Answer Key: Implementing Reports with SQL Server Reporting Services

3.

Right-click the Map Title textbox and click Title Properties. Then in the Map Title Properties
dialog box, change the title text to Sales by State and click OK.

4.

Right-click the color scale at the bottom left of the map and deselect the Show Color Scale
option.

5.

Click the Preview tab and view the report, verifying that the map indicates sales volume in each state
by the shade of the color used to fill the state.

6.

Point the mouse to any state that has a blue fill color and verify that the tooltip displayed shows the
sales figure for that state.

7.

Close SQL Server Data Tools.

Lab Answer Key: Supporting Self Service Reporting

Module 3
Lab Answer Key: Supporting Self Service Reporting
Contents:
Exercise 1: Using Report Builder

Exercise 2: Simplifying Data Access for Business Users

Exercise 3: Using Report Parts

Lab Answer Key: Supporting Self Service Reporting

Lab 3: Implementing Self Service Reporting


Exercise 1: Using Report Builder
Task 1: Prepare the lab environment
1.

Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running. Then log on to MIA-SQLBI as
ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab03, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab03\Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd) and click Run as administrator.

5.

Click Yes when prompted to confirm you want to run the command file, and wait for the script to
finish.

Task 2: Install Report Builder


1.

On the Start menu, click Internet Explorer and open the SharePoint portal site at http://mia-sqlbi.

2.

In the Quick Launch area, under Libraries, click Reports.

3.

In the ribbon, on the Documents tab, in the New Document drop-down list, click Report Builder
Report. If you are prompted, click Run, and wait for Report Builder to be downloaded. The
application starts automatically after it has been downloaded.

Task 3: Create a report


1.

In the Getting Started dialog box, ensure that New Report is selected and click Table or Matrix
Wizard.

2.

On the Choose a dataset page, ensure Create a dataset is selected, and click Next.

3.

On the Choose a connection to a data source page, click New, and in the Data Source Properties
dialog box, create a data source with the following settings and click OK. Then click Next.

On the General tab, change the Name property to AdventureWorksDW, ensure that the
Microsoft SQL Server connection type is selected, and enter the following connection string:
Data source=localhost;Initial Catalog=AdventureWorksDW

4.

On the Credentials tab, ensure that the Use current Windows user. Kerberos delegation
might be required option is selected.

On the Design a query page, in the Database view pane, expand Tables, expand the
DimProductCategory, DimProductSubcategory, DimProduct, DimGeography, DimReseller, and
FactResellerSales tables, and select the following fields:

DimProductCategory.EnglishProductCategoryName

DimProductSubcategory.ProductCategoryKey

Lab Answer Key: Supporting Self Service Reporting

DimProduct.ProductSubcategoryKey

DimGeography.EnglishCountryRegionName

DimGeography.StateProvinceName

DimGeography.City

DimReseller.GeographyKey

FactResellerSales.ResellerKey

FactResellerSales.SalesAmount

5.

After you have selected the fields, expand the Relationships pane and review the relationships that
have been automatically detected. Then click Next.

6.

On the Arrange fields page, drag and drop the fields to the following groups and then click Next:

Row groups:
EnglishCountryRegionName
StateProvinceName
City

Column groups:
EnglishProductCategoryName

Values:
SalesAmount

7.

On the Choose the layout page, ensure that Show subtotals and grand totals, Blocked, subtotal
below, and Expand/collapse groups are all selected, and then click Next.

8.

On the Choose a style page, in the Styles list, select Generic. Then click Finish.

Task 4: Format the report


1.

Click the Click to add title textbox, and type Reseller Sales by Product Category.

2.

Click the cell containing the expression [Sum(SalesAmount)] directly beneath the
[EnglishProductCategoryName] cell, and then hold the Shift key and click the
[Sum(SalesAmount)] field at the bottom right of the tablix data region to select all of the
[Sum(SalesAmount)] cells. Then on the toolbar, click the currency ($) format button.

3.

Click the Run button to preview the report, and then click the Design button to return to design view
and apply any additional formatting you think is appropriate.

Lab Answer Key: Supporting Self Service Reporting

Task 5: Publish the report


1.

In the quick access toolbar, click Save. Then in the Save As Report dialog box, browse to the
http://mia-sqlbi/Reports folder, in the Name box type Reseller Sales by Product Category.rdl, and
click Save.

2.

Close Report Builder.

3.

In Internet Explorer, in the Quick Launch area of the http://mia-sqlbi SharePoint site, under Libraries,
click Reports to refresh the view and note that the Reseller Sales by Product Category report has
been published in the Reports document library.

4.

Click Reseller Sales by Product Category and view the report.

5.

After you have viewed the report, at the top of the page, click the Reports link to return to the
Reports document library. Keep Internet Explorer open for the next exercise.

Lab Answer Key: Supporting Self Service Reporting

Exercise 2: Simplifying Data Access for Business Users


Task 1: Create a shared data source
1.

In the ribbon, on the Documents tab, in the New Document drop-down list, click Report Data
Source.

2.

In the Data Source Properties page, configure a data source with the following settings and click
OK:

Name: Adventure Works Data Warehouse

Data Source Type: Microsoft SQL Server

Connection string: Data source=localhost;Initial Catalog=AdventureWorksDW

Credentials: Windows authentication (integrated) or SharePoint user

Availability: Enable this data source selected

Task 2: Create shared datasets


1.

In the ribbon, on the Documents tab, in the New Document drop-down list, click Report Builder
Report.

2.

When Report Builder starts, in the Getting Started dialog box, select New Dataset.

3.

In the Getting Started dialog box, click Browse other data sources and browse to the
http://mia-sqlbi/Reports folder. Then select the Adventure Works Data Warehouse.rsds shared
data source you created in the previous task and click Open.

4.

In the Getting Started dialog box, ensure that the Adventure Works Data Warehouse.rds data
source is selected, and click Create.

5.

On the ribbon, in the Query Designer section, click Import. Then browse to the
D:\10778A\Labfiles\Lab03\Starter folder, select Reseller Sales By Year.sql, and click Open.

6.

Expand the query pane so you can see the Transact-SQL query, and note that the query includes a
parameter named @CalendarYear.

7.

On the ribbon, click Set Options, and then in the Shared Dataset Properties dialog box, on the
Parameters tab, set the data type of the @CalendarYear parameter to Integer and select the Allow
multiple values checkbox. Then click OK.

8.

On the ribbon, click the Run button, enter the parameter value 2004, and click OK. When the query
has completed, review the results, which show reseller sales for the year 2004.

9.

In the quick access toolbar, click Save. Then in the Save As Dataset dialog box, browse to the
http://mia-sqlbi/Reports folder, in the Name box type Reseller Sales by Year.rsd, and save the
dataset.

10. Click the round button at the top left of the ribbon, and on the Report Builder menu, click New.
Then in the New Report or Dataset dialog box, select New Dataset, select the Adventure Works
Data Warehouse.rsds dataset, and click Create.
11. On the ribbon, in the Query Designer section, click Import. Then browse to the
D:\10778A\Labfiles\Lab03\Starter folder, select Reseller Years.sql, and click Open.

Lab Answer Key: Supporting Self Service Reporting

12. On the ribbon, click the Run button. When the query has completed, review the results, which show
all years in which there have been any reseller sales.
13. In the quick access toolbar, click Save. Then in the Save As Dataset dialog box, browse to the
http://mia-sqlbi/Reports folder, in the Name box type Reseller Years.rsd, and save the dataset.
14. Repeat the previous four steps to create a new dataset from the Most Recent Reseller Year.sql
query file and save it in the http://mia-sqlbi/Reports folder as Most Recent Reseller Year.rsd.

Task 3: Create a report from shared data items


1.

Click the round button at the top left of the ribbon, and on the Report Builder menu, click New.
Then in the New Report or Dataset dialog box, select New Report and click Table or Matrix
Wizard.

2.

On the Choose a dataset page, select Choose an existing dataset in this report or a shared
dataset, click Browse and in the http://mia-sqlbi/Reports folder, click Reseller Sales by Year.rsd and
click Open. Then click Next.

3.

On the Arrange fields page, drag and drop the fields to the following groups and then click Next.

Row groups
CalendarYear
Month

Column groups
ProductCategory

Values
SalesAmount

4.

On the Choose the layout page, ensure that Show subtotals and grand totals, Blocked, subtotal
below, and Expand/collapse groups are all selected, and then click Next.

5.

On the Choose a style page, in the Styles list, select Generic. Then click Finish.

6.

In the Report Data pane, right-click the Datasets folder and click Add Dataset. Then add a dataset
with the following settings and click OK:

7.

Name: Years

Use a shared dataset: Selected

Dataset: Browse to the http://mia-sqlbi/Reports folder and select the Reseller Years.rsd dataset.

In the Report Data pane, right-click the Datasets folder and click Add Dataset again. Then add a
dataset with the following settings and click OK:

Name: MostRecentYear

Use a shared dataset: Selected

Dataset: Browse to the http://mia-sqlbi/Reports folder and select the Most Recent Reseller
Year.rsd dataset.

Lab Answer Key: Supporting Self Service Reporting

8.

9.

In the Report Data pane, expand the Parameters folder and then right-click the CalendarYear
parameter and click Parameter Properties. Then, in the Report Parameter Properties dialog box,
make the following configuration changes and click OK.

On the Available Values tab, select Get values from a query. Then in the Dataset drop-down
list, select Years; in the Value field drop-down list, select CalendarYear; and in the Label field
drop-down list, select CalendarYear.

On the Default Values tab, select Get values from a query. Then in the Dataset drop-down list,
select MostRecentYear and in the Value field drop-down list, select CalendarYear.

Click the Click to add title textbox and type Reseller Sales by Year. Then format the cells in the
tablix data region as you think appropriate.

10. In the Groupings pane, in the Month group drop-down list, click Group Properties. Then on the
Sorting tab, change the Sort by field to MonthNo so that the months are sorted in calendar order,
and click OK.
11. Click Run the preview the report. Note that sales for the most recent year (2004) are shown by
default, but you can change the year to any of the available years.
12. In the quick access toolbar, click Save. Then in the Save As Report dialog box, browse to the
http://mia-sqlbi/Reports folder, in the Name box type Reseller Sales by Year.rdl, and click Save.

Lab Answer Key: Supporting Self Service Reporting

Exercise 3: Using Report Parts


Task 1: Create a report part
1.

Click the round button at the top left of the ribbon, and on the Report Builder menu, click New.
Then in the New Report or Dataset dialog box, select New Report and click Chart Wizard.

2.

On the Choose a dataset page, select Create a dataset and click Next.

3.

On the Choose a connection to a data source page, select the Adventure Works Data
Warehouse.rsds shared data source and click Next.

4.

On the Design a query page, click Import and browse to the D:\10778A\Labfiles\Lab03\Starter
folder, select Count Resellers by Country.sql, and click Open. Then on the toolbar, click the Run
button to verify that the query returns a list of countries with the number of resellers in each country,
and click Next.

5.

On the Choose a chart type page, select Pie, and click Next.

6.

On the Arrange chart fields page, drag Country to the Categories list, and drag Resellers to the
Values list. Then click Next.

7.

On the Choose a style page, select Generic, and then click Finish.

8.

When the report has been created, click the Chart Title text box and then select the text and change
it to Resellers by Country. Then resize the chart to make it bigger.

9.

With the chart selected, on the View tab of the ribbon, select Properties. Then in the Properties
pane, change the Name property of the chart to ResellersChart.

10. In the Report Data pane, expand Datasets, right-click DataSet1 and click Dataset Properties. Then
in the Dataset Properties dialog box, change the Name property to ResellersByCountry and click
OK.
11. Click the round button at the top left of the ribbon, and on the Report Builder menu, click Publish
Report Parts, and in the Choose Sharepoint Document Library dialog box, select the Reports
document library and click OK. Then on the Publish Report parts dialog box, click Review and
modify report parts before publishing.
12. In the Publish Report Parts dialog box, expand ResellersChart and in the description box, type
Chart showing the number of resellers in each country. Then click Publish, and when the Result
message shows that a report part was published successfully, click Close.

Task 2: Use a report part


1.

Click the round button at the top left of the ribbon, and on the Report Builder menu, click New.
When prompted to save the current report, click No. Then in the New Report or Dataset dialog box,
select New Report and click Blank Report.

2.

In the ribbon, on the Insert tab, click Report Parts.

3.

In the Report Part Gallery pane, in the search box type Resellers and click the search button. Note
that the ResellersChart report part you published in the previous task is listed in the results.

4.

Drag the ResellersChart report part to the body of the report.

5.

Right-click the chart title, point to Chart, and click Chart Properties. Then in the Chart properties
dialog box, in the Color palette drop-down list, select Semi transparent and click OK.

Lab Answer Key: Supporting Self Service Reporting

6.

Click the Click to add title textbox and type Resellers By Country - Pie Chart.

7.

On the Home tab, click Run to preview the report and note that the report part is shown with the
semi-transparent color palette in this report.

8.

In the quick access toolbar, click Save. Then in the Save As Report dialog box, browse to the
http://mia-sqlbi/Reports folder, in the Name box type Resellers By Country - Pie Chart.rdl, and
click Save.

9.

Click the round button at the top left of the ribbon, and on the Report Builder menu, click New.
Then in the New Report or Dataset dialog box, select New Report and click Blank Report.

10. Drag the ResellersChart report part from the Report Parts Gallery pane to the body of the report.
11. Right-click the chart title, point to Chart, and click Change Chart Type. Then in the Select Chart
Type dialog box, select the first chart in the Column section and click OK.
12. Click the Click to add title textbox and type Resellers By Country - Column Chart. Then delete the
axis titles from the chart.
13. Click Run to preview the report and note that the report part is shown as a column chart in this
report.
14. In the quick access toolbar, click Save. Then in the Save As Report dialog box, browse to the
http://mia-sqlbi/Reports folder, in the Name box type Resellers By Country - Column Chart.rdl,
and click Save.
15. Close Report Builder and Internet Explorer.

Lab Answer Key: Managing Report Execution and Delivery

Module 4
Lab Answer Key: Managing Report Execution and Delivery
Contents:
Exercise 1: Configuring Report Execution

Exercise 2: Implementing a Standard Subscription

Exercise 3: Implementing a Data-Driven Subscription

Lab Answer Key: Managing Report Execution and Delivery

Lab 4: Configuring Report Execution and


Delivery
Exercise 1: Configuring Report Execution
Task 1: Prepare the lab environment
1.

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running. Then log on to
MIA-SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab04, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab04\Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd) and click Run as administrator.

5.

Click Yes when prompted to confirm you want to run the command file, and wait for the script to
finish.

Task 2: Deploy reports


1.

In the D:\10778A\Labfiles\Lab04\Starter folder, double-click AWReports.sln to open the solution in


SQL Server Data Tools. Note that the project contains a shared data source named
AdventureWorksDW and a report named Monthly Sales Report.

2.

In Solution Explorer, right-click AWReports and click Properties. Then, in the AWReports Property
Pages dialog box, note the deployment properties and click OK.

3.

On the Build menu, click Deploy AWReports. Then wait for the Output pane to display the message
Deploy complete 0 errors, 0 warnings, and close SQL Server Data Tools.

Task 3: Configure a shared data source


1.

Start Internet Explorer and browse to SharePoint site at http://mia-sqlbi. Then, in the quick launch
area, under Libraries, click Reports.

2.

In the Reports document library, note that the AdventureWorksDW data source and Monthly
Sales Report report have been deployed, and on the drop-down list for the AdventureWorksDW
data source, click View Dependent Items and note that the Monthly Sales Report report has a
dependency on this data source. Then click Close.

3.

On the drop-down list for the AdventureWorksDW data source, click Edit Data Source Definition,
and in the Credentials section of the configuration page, note that the data source is currently
configured to use the Windows authentication (Integrated) or SharePoint user option.

4.

In the Credentials section, select the Stored credentials option and enter the following credentials:

5.

User Name: ADVENTUREWORKS\ServiceAcct

Password: Pa$$w0rd

Select Use as Windows credentials and click Text Connection. Then when the connection has been
tested successfully, click OK.

Lab Answer Key: Managing Report Execution and Delivery

Task 4: Configure a report


1.

In the Reports document library, on the drop-down menu for the Monthly Sales Report report, click
Manage Processing Options.

2.

In the Data Refresh Options section, select the Use cached data option, and then in the Cache
Options section, select On a custom schedule and click Configure.

3.

In the Frequency section, select Day, in the Schedule section select all of the days and set the Start
time to 12:00 am, and click OK. Then click OK again to set the processing options and return to the
Reports document library.

4.

Click Monthly Sales Report and wait while the report is rendered. Then note the execution date and
time under the report heading.

5.

At the top of the report page, click the Reports link to return to return to the Reports document
library, and then click Monthly Sales Report again. Note that the execution date and time have not
changed because the report has been cached.

6.

Keep the report open for the next exercise.

Lab Answer Key: Managing Report Execution and Delivery

Exercise 2: Implementing a Standard Subscription


Task 1: Subscribe to a report
1.

With the Monthly Sales Report report displayed in the browser, on the Actions menu, click
Subscribe.

2.

In the Delivery Extension drop-down list, ensure E-Mail is selected.

3.

In the Delivery Options section, enter the following options:

To: student@adventureworks.msft

Comment: The sales report is attached.

4.

In the Report Contents section, ensure that Show report inside message is selected and in the
Format drop-down list, select Excel.

5.

In the Delivery Event section, ensure that On a custom schedule is selected and click Configure.
Then define a custom schedule that will send the report every day in two minutes from the current
time and click OK. You can determine the current system time by starting a command prompt
window and entering the command time /T.

6.

In the Parameters section, ensure that Use Report Default Value is selected. Then click OK.

Task 2: Verify the subscription


1.

At the top of the report page, click the Reports link to return to return to the Reports document
library.

2.

In the drop-down list for the Monthly Sales Report report, click Manage Subscriptions. Then view
the information about the E-Mail subscription you created in the previous task.

3.

Wait two minutes and then refresh the page. The Last Results column should indicate that mail was
sent to student@adventureworks.msft.

4.

View the contents of the C:\inetpub\mailroot\Drop folder and note the email messages that have
been received by the local SMTP server.

5.

Double-click the most recent message to open it with Microsoft Outlook, and read the email
message. Then open the attached Monthly Sales Report.xlsx Excel file and view the report.

6.

Close Excel and the e-mail message.

7.

In Internet Explorer, click Close to return to the Reports document library.

Lab Answer Key: Managing Report Execution and Delivery

Exercise 3: Implementing a Data-Driven Subscription


Task 1: Create a table of subscription data
1.

In the D:\10778A\Labfiles\Lab04\Starter folder, double-click Subscription Table.sql to open it in SQL


Server Management Studio. Each time you are prompted, use Windows authentication to connect to
the database engine on the localhost server.

2.

View the Transact-SQL code and note that it creates and populates a table named
ReportSubscriptions, which contains the following columns:

3.

SubscriptionID a unique primary key

RecipientEmail the email address of a subscription recipient

ReportFormat the format in which the report should be rendered

Linked a Boolean value that indicates whether the subscription email should include a link to
the report on the report server

Click Execute to run the query. Then when it has completed, close SQL Server Management Studio.

Task 2: Create a data-driven subscription


1.

In Internet Explorer, in the Reports document library in the http://mia-sqlbi SharePoint site, in the
drop-down list for the Monthly Sales Report report, click Manage Subscriptions.

2.

Click Add Data-Driven Subscription.

3.

In the Description text box, type Weekly Sales Report.

4.

In the Connection Type section, select Shared data source.

5.

In the Data Source Link section, click the ellipsis () button, and then in the Select an Item dialog
box, select the AdventureWorksDW data source and click OK.

6.

In the Query section, type the following query and click Validate. When the query is validated
successfully, click Next.
SELECT * FROM ReportSubscriptions

7.

In the Calendar Year section, ensure that Use report default value is selected, and click Next.

8.

In the Delivery Type section, ensure that E-Mail is selected Then set the following configuration
values and click Next.

9.

To: Select a value from the database (select RecipientEmail)

Include Report: True

Render Format: Select a value from the database (select ReportFormat)

Subject: Specify a static value (enter Weekly sales report)

Comment: Specify a static value (enter The weekly sales report is attached)

Include Link: Select a value from the database (select Linked)

In the Delivery Event section, ensure that On a custom schedule is selected.

Lab Answer Key: Managing Report Execution and Delivery

10. In the Frequency section, select Day.


11. In the Schedule section, select the current day and enter a time that is two minutes later than the
current time. You can determine the current system time by starting a command prompt window and
entering the commands and time /T. You can also use the command echo %date% to determine the
current day and date.
12. Click Finish and view the subscription details.

Task 3: Verify the subscription


1.

Wait for two minutes and then refresh the page. When the subscription has been processed, the Last
Results column should contain the message Done: 3 processed of 3 total; 0 errors.

2.

View the contents of the C:\inetpub\mailroot\Drop folder and note the email messages that have
been received by the local SMTP server.

3.

Open the three most recent messages, and verify that the report has been sent in Excel, Word, and
embedded HTML formats.

4.

Close all attachments, email messages, and folder windows. Then close Internet Explorer.

Lab Answer Key: Creating Multidimensional Databases

Module 5
Lab Answer Key: Creating Multidimensional Databases
Contents:
Exercise 1: Creating a Data Source

Exercise 2: Creating and Modifying a Data Source View

Exercise 3: Creating and Modifying a Cube

Lab Answer Key: Creating Multidimensional Databases

Lab 5: Creating a Multidimensional


Database
Exercise 1: Creating a Data Source
Task 1: Prepare the lab environment
1.

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to
MIA-SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab05, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab05\Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd), and then click Run as
administrator.

5.

Click Yes when prompted to confirm that you want to run the command file, and then wait for the
script to finish.

Task 2: Create a new SSAS project


1.

Click Start, point to All Programs, click Microsoft SQL Server 2012, and then click SQL Server Data
Tools.

2.

On the File menu, point to New, and then click Project.

3.

In the Templates pane, click Analysis Services Multidimensional and Data Mining Project.

4.

Change the value in the Name box to Adventure Works OLAP.

5.

Click Browse, browse to the D:\10778A\Labfiles\Lab05\Starter folder, and then click Select Folder.

6.

Click OK.

Task 3: Create a data source for the AdventureWorksDW relational database


1.

In Solution Explorer, right-click the Data Sources folder, and then click New Data Source.

2.

On the Welcome to the Data Source Wizard page, click Next.

3.

On the Select how to define the connection page, click New.

4.

In the Connection Manager dialog box, in the Server name box, type localhost.

5.

In the Log on to the server area, ensure that Use Windows Authentication is selected.

6.

In the Connect to a database area, in the Select or enter a database name box, click
AdventureWorksDW, and then click OK.

7.

On the Select how to define the connection page, click Next.

Lab Answer Key: Creating Multidimensional Databases

8.

On the Impersonation Information page, select Use a specific Windows user name and
password.

9.

In the User name box, type ADVENTUREWORKS\Student.

10. In the Password box, type Pa$$w0rd, and then click Next.
11. On the Completing the Wizard page, change the data source name to Adventure Works Data
Warehouse, and then click Finish.

Lab Answer Key: Creating Multidimensional Databases

Exercise 2: Creating and Modifying a Data Source View


Task 1: Create a data source view
1.

In Solution Explorer, right-click the Data Source Views folder, and then click New Data Source
View.

2.

On the Welcome to the Data Source View Wizard page, click Next.

3.

On the Select a Data Source page, verify that the Adventure Works Data Warehouse data source
is selected, and then click Next.

4.

In the Available objects list, click DimCustomer (dbo), and then hold down the Ctrl key and click
DimDate (dbo), DimGeography (dbo), DimProduct (dbo), and FactInternetSales (dbo).

5.

On the Select Tables and Views page, click the > button to add the selected tables to the Included
objects list, and then click Next.

6.

On the Completing the Wizard page, change the name of the data source view to Adventure
Works DSV, and then click Finish.
Notice that the Data Source View Designer opens automatically after you click Finish.

Task 2: Modify the data source view


1.

In the Data Source View Designer, use the Zoom icon to change the zoom level to 50%.

2.

In the Diagram pane, click the FactInternetSales table.

3.

In the Properties pane, in the FriendlyName box, type InternetSales.

4.

In the Diagram pane, click the DimCustomer table.

5.

In the Properties pane, in the FriendlyName box, type Customer.

6.

Change the FriendlyName property of the remaining tables to remove the Dim prefix.

7.

In the Diagram pane, right-click the Customer table, and then click New Named Calculation.

8.

In the Create Named Calculation dialog box, in the Column name box, type Full Name.

9.

In the Expression box, type the text in the following code example.
CASE
WHEN MiddleName IS NULL THEN
FirstName + ' ' + LastName
ELSE
FirstName + ' ' + MiddleName + ' ' + LastName
END

10. In the Create Named Calculation dialog box, click OK.


11. On the File menu, click Save All.

Lab Answer Key: Creating Multidimensional Databases

Exercise 3: Creating and Modifying a Cube


Task 1: Create a cube
1.

In Solution Explorer, right-click the Cubes folder, and then click New Cube.

2.

On the Welcome to the Cube Wizard page, click Next.

3.

On the Select Creation Method page, verify that Use existing tables is selected, and then click
Next.

4.

On the Select Measure Group Tables page, click Suggest.

5.

Note that the wizard selects the InternetSales table as the measure group table, and then click Next.

6.

On the Select Measures page, clear every check box except Unit Price, Unit Price Discount Pct,
Sales Amount, Tax Amt, and Internet Sales Count and click Next.

7.

On the Select New Dimensions page, clear the Internet Sales check box, and then click Next.
Note that by clearing the check box for the Internet Sales dimension, the check box for the
InternetSales table clears automatically.

8.

On the Completing the Wizard page, change the Cube name to Adventure Works Cube, and then
click Finish. The Cube Designer opens automatically after you click Finish.

Task 2: Modify the cube


1.

In the Measures pane of the Cube Designer, expand the Internet Sales measure group, right-click the
Unit Price Discount Pct measure, and then click Rename.

2.

Rename Unit Price Discount Pct to Unit Price Discount Percent.

3.

In the Measures pane, right-click Tax Amt, and then click Rename.

4.

Rename Tax Amt to Tax Amount.

5.

On the File menu, click Save All.

Task 3: Modify dimensions


1.

In Solution Explorer, in the Dimensions group, right-click Customer.dim, and then click View
Designer.

2.

In the Data Source View pane, in the Geography table, click City.

3.

Hold down the Ctrl key, click StateProvinceName, EnglishCountryRegionName, and


SalesTerritoryKey, and then drag the selected columns to the Attributes pane.

4.

In the Data Source View pane, in the Customer table, click CustomerAlternateKey.

5.

Hold down the Ctrl key, click Title, FirstName, MiddleName, LastName, and Full Name.

6.

Drag the selected columns to the Attributes pane.

7.

On the File menu, click Save All.

8.

Close the Customer.dim dimension designer.

9.

In Solution Explorer, in the Dimensions group, right-click Product.dim, and then click View
Designer.

Lab Answer Key: Creating Multidimensional Databases

10. In the Data Source View pane, in the Product table, click ProductAlternateKey.
11. Hold down the Ctrl key, click ProductSubcategoryKey, EnglishProductName, and ListPrice and
drag the selected columns to the Attributes pane.
12. On the File menu, click Save All.
13. Close the Product.dim dimension designer.
14. In Solution Explorer, in the Dimensions group, right-click Date.dim, and then click View Designer.
15. In the Data Source View pane, in the Date table, click FullDateAlternateKey.
16. Hold down the Ctrl key, click EnglishDayNameOfWeek, EnglishMonthName,
MonthNumberOfYear, CalendarQuarter, CalendarYear, and CalendarSemester, and drag the
selected columns to the Attributes pane.
17. On the File menu, click Save All. Keep the Date.dim designer open for the next task.

Task 4: Modify attribute columns


1.

In the Attributes pane, right-click Calendar Semester, and click Properties.

2.

In the Properties pane, scroll down to the Source section.

3.

Click the KeyColumns field, and then click the ellipses () button.

4.

In the Key Columns dialog box, in the Available Columns table, click Calendar Year, and then click
the Right Arrow (>) icon.

5.

Click the Up Arrow icon to move CalendarYear above CalendarSemester, and then click OK.

6.

In the Properties pane, click the NameColumn field, and then click the ellipses () button.

7.

In the Name Column dialog box, in the Source column field, click CalendarSemester, and then click
OK.

8.

In the Attributes pane, click Calendar Quarter.

9.

In the Properties pane, scroll down to the Source section.

10. Click the KeyColumns field, and then click the ellipses () button.
11. In the Key Columns dialog box, in the Available Columns table, click Calendar Year, and then click
the Right Arrow (>) icon.
12. Click the Up Arrow icon to move CalendarYear above CalendarQuarter, and then click OK.
13. In the Properties pane, click the NameColumn field, and then click the ellipses () button.
14. In the Name Column dialog box, in the Source column field, click CalendarQuarter, and then click
OK.
15. In the Attributes pane, right-click English Month Name and click Rename. Then change the
attribute name to Month.
16. With the Month attribute still selected, in the Properties pane, scroll down to the Source section,
click the KeyColumns field, and then click the ellipses () button.
17. In the Key Columns dialog box, in the Key Columns table, click EnglishMonthName, and then click
the Left Arrow (<) icon.

Lab Answer Key: Creating Multidimensional Databases

18. In the Available Columns table, click Calendar Year, and then click the Right Arrow (>) icon.
19. In the Available Columns table, click MonthNumberOfYear, click the Right Arrow (>) icon. Ensure
that Calendar Year appears above MonthNumberOfYear, and then click OK.
20. In the Properties pane, click the NameColumn field, and then click the ellipses () button.
21. In the Name Column dialog box, in the Source column field, click EnglishMonthName, and then
click OK.
22. On the File menu, click Save All.
23. Close the Date.dim dimension designer.

Task 5: Browse the cube


1.

In Solution Explorer, right-click the Adventure Works OLAP solution, and then click Deploy. If an
Account Password dialog box appears, in the Password field type Pa$$w0rd and click OK. Then
wait for the Deploy Succeeded message in the status bar.

2.

When deployment has completed successfully, in the Cube Designer, click the Browser tab.
Tip In SQL Server Data Tools, click the Auto Hide icon on the various panes to make it
easier to see the entire Cube Browser window.

3.

In the Measure Group pane, expand Measures, expand Internet Sales, and then drag the Sales
Amount measure to the Drag levels or measures here to add to the query area of the Data pane.

4.

In the Measure Group pane, drag Internet Sales Count to the right of the Sales Amount column.

5.

In the Measure Group pane, expand the Order Date dimension.

6.

Drag the Order Date.Calendar Year hierarchy to the left of the Sales Amount column. The cube
browser shows sales amounts and counts for multiple years.

7.

Minimize SQL Server Data Tools.

8.

Click Start, point to All Programs, click Microsoft Office, and then click Microsoft Excel 2010.

9.

Maximize the Microsoft Excel 2010 window.

10. On the Data tab of the ribbon, click Get External Data, click From Other Sources, and then click
From Analysis Services.
11. In the Data Connection Wizard, in the Server name field, enter localhost, verify that Use Windows
Authentication is selected, and then click Next.
12. In the Data Connection Wizard, on the Select Database and Table page, in the Select the database
that contains the data you want field select Adventure Works OLAP and click Next.
13. On the Save Data Connection File and Finish page, click Finish.
14. In the Import Data dialog box, select PivotTable Report,, verify that Existing worksheet is selected
and the location is set to =$A$1, and then click OK.
15. In the PivotTable Field List, beneath the Internet Sales measure, select Sales Amount.

Lab Answer Key: Creating Multidimensional Databases

16. Scroll down the PivotTable Field List, beneath the Customer dimension select Full Name. Notice
that the named calculation from the data source view is displaying the customers full names.
17. Choose other fields from the PivotTable Field List to continue browsing the cube. When you have
finished browsing the Adventure Works Cube cube in Excel 2010, close the window without saving
the changes.
18. Maximize SQL Server Data Tools.
19. On the File menu, click Save All to save your project. Then close SQL Server Data Tools.

Lab Answer Key: Working with Cubes and Dimensions

Module 6
Lab Answer Key: Working with Cubes and Dimensions
Contents:
Exercise 1: Configuring Dimensions

Exercise 2: Defining Relationships and Hierarchies

Exercise 2: Sorting and Grouping Dimension Attributes

Lab Answer Key: Working with Cubes and Dimensions

Lab 6: Defining Dimensions


Exercise 1: Configuring Dimensions
Task 1: Prepare the lab environment
1.

Ensure the MIA-DC and MIA-SQLBI virtual machines are both running, and then log on to
MIA-SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab06, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab06\Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd) and click Run as administrator.

5.

Click Yes when prompted to confirm you want to run the command file, and wait for the script to
finish.

Task 2: Remove unused attributes from dimensions


1.

Navigate to D:\10778A\Labfiles\Lab06\Starter and double-click Adventure Works OLAP.sln to open


it with SQL Server Data Tools.

2.

In Solution Explorer, right-click the Customer.dim dimension, and then click View Designer. Notice
that many attributes have been added to this dimension to allow business users to aggregate
measures in many different ways. However, users have complained that some of these attributes are
unnecessary and that they should be removed to make browsing the cube simpler.

3.

In the Attributes pane, click Commute Distance, press the Ctrl key and click Number Cars Owned
and Number Children At Home, right-click any of the highlighted attributes, and then click Delete.

4.

In the Delete Objects dialog box, click OK.

5.

On the File menu, click Save All. Then close the Customer dimension designer.

6.

In Solution Explorer, right-click the Product.dim dimension, and then click View Designer. Again,
users have requested that you remove some unnecessary attributes from this dimension.

7.

In the Attributes pane, right-click the Days To Manufacture attribute, press the Ctrl key and click
Safety Stock Level. Then click Delete.

8.

In the Delete Objects dialog box, click OK.

9.

On the File menu, click Save All. Then close the Product dimension designer.

Task 3: Add dimension intelligence


1.

In Solution Explorer, right-click Date.dim, and then click Add Business Intelligence.

2.

On the Welcome to the Business Intelligence Wizard page, click Next.

3.

On the Choose Enhancement page, click Define dimension intelligence, and then click Next.

4.

On the Define Dimension Intelligence page, in the Dimension type field, click Time.

Lab Answer Key: Working with Cubes and Dimensions

5.

In the Dimension attributes table, select the Include check box for the following Attribute Types,
and select the corresponding item in the Dimension Attribute column:
Attribute Type

Dimension Attribute

Year

Calendar Year

Half Year

Calendar Semester

Quarter

Calendar Quarter

Month

Month

Date

Simple Date

Note You might need to resize the columns to view Attribute Type and Dimension
Attribute.
6.

Click Next, and then click Finish.

Lab Answer Key: Working with Cubes and Dimensions

Exercise 2: Defining Relationships and Hierarchies


Task 1: Create attribute relationships in the Date dimension
1.

In Solution Explorer, right-click the Date.dim dimension, and then click View Designer.

2.

In the Properties pane, note that the Type property for this dimension has been set to Time. This
occurred when you added dimension intelligence in the previous exercise.

3.

In the designer pane, click the Attributes Relationships tab.

4.

In the Attribute Relationships diagram pane, right-click an empty space, and then click New
Attribute Relationship.

5.

In the Create Attribute Relationship dialog box, in the Source Attribute section, in the Name field,
click Simple Date.

6.

In the Related Attribute section, in the Name field, click Month.

7.

In the Relationship type field click Rigid (will not change over time) because a particular date will
always be in the same month and then click OK.

8.

Repeat steps 5-7 to create the following relationships:


Source Attribute

9.

Related Attribute

Relationship type

Month

Calendar Quarter

Rigid (will not change over time)

Calendar Quarter

Calendar Semester

Rigid (will not change over time)

Calendar Semester

Calendar Year

Rigid (will not change over time)

When you have finished, on the File menu, click Save All.

Task 2: Create a natural hierarchy in the Date dimension


1.

In the designer pane for the Date.dim dimension, click the Dimension Structure tab.

2.

In the Attributes pane, drag Calendar Year into the Hierarchies pane.

3.

In the Attributes pane, drag the following attributes one-by-one to the Hierarchies pane and drop
them on to the <new level> area:

Calendar Semester

Calendar Quarter

Month

SimpleDate

4.

In the Hierarchies pane, click the title bar of the Hierarchy hierarchy.

5.

In the Properties pane, change the Name field to Calendar Date.

Lab Answer Key: Working with Cubes and Dimensions

6.

In the Attributes pane, select Calendar Year, press the Ctrl key and click Calendar Semester,
Calendar Quarter, Month, and Simple Date to select all of these attributes.

7.

In the Properties pane, change the AttributeHierarchyVisible property to False. This defines these
attributes as member properties rather than hierarchies in their own right, so that users can only
browse them through the Calendar Date hierarchy.

8.

On the File menu, click Save All. Then close the date dimension designer.

Task 3: Create attribute relationships in the Customer dimension


1.

In Solution Explorer, right-click the Customer.dim dimension, and then click View Designer.

2.

Click the Attribute Relationships tab.

3.

In the Attribute Relationships pane, right-click an empty space, and then click New Attribute
Relationship.

4.

In the Create Attribute Relationship dialog box, in the Source Attribute section, in the Name field,
click Full Name.

5.

In the Related Attribute section, in the Name field, click Postal Code.

6.

In the Relationship type field, ensure that Flexible (may change over time) is selected, because the
geographic relationships might be redefined over time, and then click OK.

7.

Repeat steps 2-4 to create the following relationships:


Source Attribute

Related Attribute

Relationship type

Postal Code

City

Flexible (may change over time)

City

State-Province Name

Flexible (may change over time)

State-Province
Name

English Country Region Name

Flexible (may change over time)

Marital Status

Gender

Flexible (may change over time)

Task 4: Create hierarchies in the Customer dimension


1.

In the designer pane for the Customer.dim dimension, click the Dimension Structure tab.

2.

In the Attributes pane, drag English Country Region Name into the Hierarchies pane.

3.

In the Attributes pane, drag the following attributes one-by-one to the Hierarchies pane and drop
them on to the <new level> area:

State Province Name

City

Postal Code

Full Name

4.

In the Hierarchies pane, click the title bar of the Hierarchy hierarchy.

5.

In the Properties pane, change the Name field to Customer Geography.

Lab Answer Key: Working with Cubes and Dimensions

6.

In the Attributes pane, drag Gender into an empty area of the Hierarchies pane.

7.

In the Attributes pane, drag Marital Status to the <new level> area beneath Gender in the
Hierarchies pane.

8.

In the Hierarchies pane, click the title bar of the Hierarchy hierarchy.

9.

In the Properties pane, change the Name field to Gender - Marital Status.

10. In the Attributes pane, select English Country Region Name, press the Ctrl key and click State
Province Name, City, Postal Code, Full Name, Gender, and Marital Status to select all of these
attributes.
11. In the Properties pane, change the AttributeHierarchyVisible property to False.
12. On the File menu, click Save All.
13. Close the customer dimension designer.

Task 5: Create attribute relationships in the Product dimension


1.

In Solution Explorer, right-click the Product.dim dimension, and then click View Designer.

2.

Click the Attribute Relationships tab.

3.

In the Attribute Relationships pane, right-click an empty space, and then click New Attribute
Relationship.

4.

In the Create Attribute Relationship dialog box, in the Source Attribute section, in the Name field,
click English Product Name.

5.

In the Related Attribute section, in the Name field, click English Product Subcategory Name.

6.

In the Relationship type field, ensure that Flexible (may change over time) is selected, because the
product categorization relationships might be redefined over time, and then click OK.

7.

In the Attribute Relationships pane, right-click an empty space, and then click New Attribute
Relationship.

8.

In the Create Attribute Relationship dialog box, in the Source Attribute section, in the Name field,
click English Product Subcategory Name.

9.

In the Related Attribute section, in the Name field, click English Product Category Name.

10. In the Relationship type field, ensure that Flexible (may change over time) is selected, because the
product categorization relationships might be redefined over time, and then click OK.
11. On the File menu, click Save All.

Task 6: Create hierarchies in the Product dimension


1.

In the designer pane for the Product.dim dimension, click the Dimension Structure tab.

2.

In the Attributes pane, drag English Product Category Name into an empty area of the Hierarchies
pane.

3.

In the Attributes pane, drag English Product Subcategory Name to the <new level> area beneath
English Product Category Name in the Hierarchies pane.

4.

In the Attributes pane, drag English Product Name to the <new level> area beneath English
Product Subcategory Name in the Hierarchies pane.

Lab Answer Key: Working with Cubes and Dimensions

5.

In the Hierarchies pane, click the title bar of the Hierarchy hierarchy.

6.

In the Properties pane, change the Name field to Product Category.

7.

In the Attributes pane, select English Product Category Name, press the Ctrl key and click English
Product Subcategory Name and English Product Name to select all of these attributes.

8.

In the Properties pane, change the AttributeHierarchyVisible property to False.

9.

On the File menu, click Save All.

10. Close the product dimension designer.

Task 7: Browse the hierarchies you have created


1.

In Solution Explorer, right-click the Adventure Works OLAP solution, and then click Deploy. If an
Account Password dialog box appears, in the Password field type Pa$$w0rd and click OK. Then
wait for the Deploy Succeeded message in the status bar.

2.

In Solution Explorer, right-click the Customer dimension, and then click Browse.

3.

In the Hierarchy drop-down list, ensure that Customer Geography is selected. Then expand the All
level of the hierarchy and note that several countries are listed along with an Unknown level for
customers where the country is not known.

4.

Expand Australia, and note that several states are listed. Then continue expanding the levels to
explore the hierarchy.

5.

In the Hierarchy drop-down list, select Gender Marital Status, and explore this hierarchy.

6.

In Solution Explorer, right-click the Adventure Works Cube.cube cube, and then click Browse.

7.

In the Measure Group pane, expand Measures, expand Internet Sales, and then drag the Sales
Amount measure to the Drag levels or measures here to add to the query area of the Data pane.

8.

In the Measure Group pane, expand Product and drag the Product Category hierarchy to the left of
the Sales Amount column; and note that the hierarchy displays products by category, subcategory,
and individual product name.

Lab Answer Key: Working with Cubes and Dimensions

Exercise 3: Sorting and Grouping Dimension Attributes


Task 1: Modify the sort order of the Month attribute
1.

In Solution Explorer, right-click the Date dimension, and then click Browse.

2.

In the Hierarchy drop-down list, ensure that Calendar Date is selected. Then expand the All level of
the hierarchy and note that several years are listed.

3.

Expand 2005, and note that two half-years are listed. Then expand H2CY2005 and note that two
quarters are listed. Finally, expand Q4 CY 2005 and note that the months in that quarter are shown.
However, the months are ordered alphabetically rather than in calendar order.

4.

Click the Dimension Structure tab of the date dimension designer.

5.

In the Attributes column, right-click Month Number of Year and click Properties.

6.

In the Properties pane, set the following values:


Property Subsection

Property

Value

Advanced

AttributeHierarchyOptimizedState

NotOptimized

Misc

AttributeHierarchyOrdered

False

7.

Click the Attribute Relationships tab. Then, in the Attributes pane, right-click Month, and click New
Attribute Relationship.

8.

In the Create Attribute Relationship window, in the Source Attribute section, in the Name field,
ensure that Month is selected. Then, in the Related Attribute section, in the Name field, click
Month Number of Year.

9.

In the Relationship type field click Rigid (will not change over time) because a particular month
will always be the same month number of the year, and then click OK.

10. Click the Dimension Structure tab.


11. In the Attributes pane, click Month.
12. In the Properties pane, in the OrderBy box, click AttributeKey, and then in the OrderByAttribute
box, click Month Number Of Year.
13. On the File menu, click Save All.
14. In Solution Explorer, right-click the Adventure Works OLAP solution, and then click Deploy. Wait for
the Deploy Succeeded message in the status bar.
15. On the Browser tab of the Date.dim Dimension Designer, click the Reconnect icon.
16. If necessary, in the Hierarchy box, click Calendar Date. Expand the hierarchy to the month level and
notice that the months are now in date order rather than alphabetical order.
17. Close the date dimension designer

Lab Answer Key: Working with Cubes and Dimensions

Task 2: Group the Yearly Income attribute hierarchy members


1.

In Solution Explorer, right-click the Customer.dim dimension, and then click View Designer.

2.

In the Data Source View pane, right-click the Customer table, and then click Explore Data. Notice
the range of values for the YearlyIncome column.

3.

On the Explore Customer Table tab, click the Close button.

4.

Click the Browser tab of the Customer.dim Dimension Designer, and then click the Reconnect
button.

5.

In the designer pane, change the Hierarchy field to Yearly Income.

6.

Expand All, and notice that the salaries have no hierarchy.

7.

Click the Dimension Structure tab. Then, in the Attributes pane, right-click Yearly Income and click
Properties.

8.

In the Properties pane, in the DiscretizationMethod box, click Automatic, in the


DiscretizationBucketCount box type 5 and in the OrderBy list, select Key.

9.

On the File menu, click Save All.

10. In Solution Explorer, right-click the Adventure Works OLAP solution, and then click Deploy. Wait for
the Deploy Succeeded message in the status bar.
11. In the customer dimension designer, click the Browser tab, and click the Reconnect icon.
12. If necessary, in the Hierarchy box, click Yearly Income and expand the All level.
13. Note that the salaries are now grouped into ranges.
14. In Solution Explorer, right-click Adventure Works Cube.cube, and then click Browse.
15. If necessary, remove any existing measures from the grid by right-clicking anywhere in the grid area
and clicking Clear Grid. Then, in the Measure Group pane, expand Measures, expand Internet Sales,
and then drag the Sales Amount measure to the Drag levels or measures here to add to the
query area of the Data pane.
16. In the Measure Group pane, expand Customer and drag the Yearly Income attribute to the left of
the Sales Amount column.
17. Notice that the individual income values have been automatically grouped.
18. Click File, and then click Save All. Then close SQL Server Data Tools.

Lab Answer Key: Working with Measures and Measure Groups

Module 7
Lab Answer Key: Working with Measures and Measure
Groups
Contents:
Exercise 1: Configuring Measures

Exercise 2: Defining a Regular Relationship

Exercise 3: Configuring Measure Group Storage

Lab Answer Key: Working with Measures and Measure Groups

Lab 7: Configuring Measures and Measure


Groups
Exercise 1: Configuring Measures
Task 1: Prepare the lab environment
1.

Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to
MIA-SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab07, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab07 Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd) and click Run as administrator.

5.

Click Yes when prompted to confirm you want to run the command file, and wait for the script to
finish.

Task 2: Create a Measure Group

1.

Browse to the D:\10778A\Labfiles\Lab07\Starter folder and double-click the Adventure Works


OLAP.sln project solution file.

2.

In Solution Explorer, right-click Adventure Works DSV.dsv, and then click View Designer.

3.

Click the Add/Remove Objects icon. Then, in the Add/Remove Tables dialog box, in the Available
objects list, select FactResellerSales (dbo) and click the > button to add the selected table to the
Included objects list.

4.

Click Add Related Tables to add the tables that are related to FactResellerSales, and then click OK.
Note that the tables have been added to the data source view, and then click Save All.

5.

Close the Adventure Works DSV.dsv designer.

6.

In Solution Explorer, right-click Adventure Works Cube.cube, and then click View Designer.

7.

Click the New Measure Group icon, and then in the New Measure Group dialog box, select
FactResellerSales and click OK.

8.

In the Measures pane, right-click the Fact Reseller Sales measure group and click Rename. Then
change the name of the measure group to Reseller Sales.

9.

Expand both the Internet Sales and Reseller Sales measure groups and review the names of the
measures they contain. Note that when the Reseller Sales measure group was created, measures
were created for all of the numerical fields in the FactResellerSales table. In cases where an measure
with the same field name already existed, a new measure was created with - Fact Reseller Sales
appended to its name.

Lab Answer Key: Working with Measures and Measure Groups

Task 3: Modify Measure Groups


1.

On the Cube Structure tab, click the Show Measures Grid icon to view all of the measures in the
cube as a grid. Note the aggregations that are used to summarize the measures when they are
analyzed across dimensions.

2.

Click the row for the Promotion Key measure, and then hold the Ctrl key and click the rows for the
following measures to select them all:

Currency Key

Sales Territory Key

Revision Number

Extended Amount

Unit Price Discount Percent

Discount Amount

Product Standard Cost

Freight

Revision Number Fact Reseller Sales

Extended Amount Fact Reseller Sales

Unit Price Discount Pct

Discount Amount Fact Reseller Sales

Product Standard Cost Fact Reseller Sales

Freight Fact Reseller Sales

3.

Click the Delete icon, and then in the Delete Objects dialog box, click OK to remove these measures
(which are not required by the business analysts who use the cube).

4.

Right-click the Order Quantity measure and click Rename. Then change the name of the measure to
Order Quantity Internet Sales.

Lab Answer Key: Working with Measures and Measure Groups

5.

Repeat the previous step for the following measures:


Measure

6.

Rename to:

Unit Price

Unit Price Internet Sales

Total Product Cost

Total Product Cost Internet Sales

Sales Amount

Sales Amount Internet Sales

Tax Amount

Tax Amount Internet Sales

Order Quantity Fact Reseller Sales

Order Quantity Reseller Sales

Unit Price Fact Reseller Sales

Unit Price Reseller Sales

Total Product Cost Fact Reseller Sales

Total Product Cost Reseller Sales

Sales Amount Fact Reseller Sales

Sales Amount Reseller Sales

Tax Amt

Tax Amount Reseller Sales

Fact Reseller Sales Count

Reseller Sales Count

Click the Show Measure Tree icon to view your measure groups as a tree. Then on the File menu,
click Save All.

Lab Answer Key: Working with Measures and Measure Groups

Exercise 2: Defining a Regular Relationship


Task 1: View existing dimensions for measure groups
1.

In Solution Explorer right click Adventure Works OLAP and click Deploy.

2.

If an Account Password dialog box appears, in the Password field type Pa$$w0rd and click OK.

3.

Wait for the Deploy Succeeded message in the status bar.

4.

In Solution Explorer, right-click Adventure Works Cube.cube and click Browse.

5.

In the Metadata pane, in the Measure Group drop-down list select Internet Sales and notice the
Product dimension.

6.

In the Measure Group drop-down list select Reseller Sales and notice that there is no Product
dimension.

Task 2: Create a dimension


1.

Click the Dimensions Usage tab.

2.

Click the cell at the intersection of the Reseller Sales measure group and the Product dimension and
click the ellipses ().

3.

In the Define Relationship dialog box, in the Select relationship type list, select Regular.

4.

In the Granularity attribute field select Product Key.

5.

In the Measure Group Columns column select ProductKey and click OK.

6.

On the File menu, click Save All.

7.

In Solution Explorer, right click Adventure Works OLAP and click Deploy.

8.

Wait for the Deploy Succeeded message in the status bar.

9.

Click the Browser tab for the Adventure Works Cube cube.

10. Click Reconnect.


11. In the Measure Group drop-down list, select Reseller Sales and notice that there is now a Product
dimension.
12. In the Metadata pane expand Measures, expand Reseller Sales, and drag Sales Amount Reseller
Sales to the Drag levels or measures here to add to the query pane.
13. In the Metadata pane, expand the Product dimension and drag the Product Category hierarchy to
the left of Sales Amount Reseller Sales and note that you can now analyze reseller sales data by
product.

Lab Answer Key: Working with Measures and Measure Groups

Exercise 3: Configuring Measure Group Storage


Task 1: Configure the storage mode of the Internet Sales measure group
1.

In Cube Designer for the Adventure Works Cube cube, on the Cube Structure tab, in the Measures
pane, right-click Internet Sales, and then click Properties.

2.

In the Properties window, click ProactiveCaching and click the ellipses () button.

3.

Under Standard setting, review each of the storage setting options. When finished, drag the slider to
Automatic MOLAP and then click OK.

Task 2: Design aggregations for the Internet Sales measure group


1.

Click the Aggregations tab of Cube Designer for the Adventure Works Cube cube.

2.

Right-click Internet Sales (0 Aggregation Designs), and then click Design Aggregations.

3.

The Aggregation Design Wizard appears. Click Next.

4.

On the Review Aggregation Usage page, click Set All to Default, and then click Next.

5.

On the Specify Object Counts page, click Count. Then, when the count process has completed, click
Next.

6.

On the Set Aggregations Options page, select Performance gain reaches and ensure that the
value is set to 35%. Then click Start.

7.

Click Stop when the optimization level reaches approximately 35%, and then click Next.

8.

On the Completing the Wizard page, change the name of the aggregation to InternetSalesAgg,
select Save the aggregations but do not process them, and then click Finish.

9.

In the Aggregations tab of Cube Designer for the Adventure Works cube, verify that Internet
Sales now has one aggregation design named InternetSalesAgg.

10. On the File menu, click Save All. Then, close the Cube Designer.
11. In Solution Explorer, right click Adventure Works OLAP and click Deploy.
12. Wait for the Deploy Succeeded message in the status bar. Then close SQL Server Data Tools.
13. Click Start, point to All Programs, click Microsoft SQL Server 2012, and then click SQL Server
Management Studio. When prompted, in the Connect to Server dialog box, specify the following
settings and click Connect:

Server type: Analysis Services

Server name: localhost

14. In Object Explorer, expand Databases, expand Adventure Works OLAP, expand Cubes, expand
Adventure Works Cube, expand Measure Groups, expand Internet Sales, and expand
Aggregation Designs.
15. Verify that the InternetSalesAgg aggregation has been deployed with the cube, and then close SQL
Server Management Studio.
Results: After this exercise, you should have defined the storage mode aggregations and for the Internet
Sales measure group.

Lab Answer Key: Introduction to MDX

Module 8
Lab Answer Key: Introduction to MDX
Contents:
Exercise 1: Querying a Cube by Using MDX

Exercise 2: Creating a Calculated Member

Lab Answer Key: Introduction to MDX

Lab 8: Using MDX


Exercise 1: Querying a Cube by Using MDX
Task 1: Prepare the lab environment
1.

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to
MIA-SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab08, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab08\Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd), and then click Run as
administrator.

5.

Click Yes when prompted to confirm that you want to run the command file, and then wait for the
script to finish.

Task 2: Deploy an OLAP database


1.

In the D:\10778A\Labfiles\Lab08\Starter folder, double-click the Adventure Works OLAP.sln project


solution file to it in SQL Server Data Tools.

2.

In the Solution Explorer pane, right-click Adventure Works OLAP, and then click Deploy.

3.

If a dialog box appears asking whether you would like to continue, click Yes.

4.

If the Account Password dialog box appears, in the Password box, type Pa$$w0rd.

5.

When deployment has completed successfully, close SQL Server Data Tools.

Task 3: Write simple MDX queries


1.

Start SQL Server Management Studio and connect to the localhost instance of Analysis Services.

2.

In the Object Explorer pane, in the Databases folder, right-click Adventure Works OLAP, point to
New Query, and then click MDX.

3.

In the query window, type the following Multidimensional Expressions (MDX) query to return the
Internet sales totals for each product category:
SELECT
[Measures].[Sales Amount Internet Sales] On 0,
NonEmpty([Product].[Product Category].[English Product Category Name].Members) On 1
FROM [Adventure Works Cube]

4.

Click Execute.

5.

Review the query results.

6.

Close the query window, clicking No when prompted to save the query.

7.

Click New Query.

Lab Answer Key: Introduction to MDX

8.

Type the following MDX query:


SELECT
[Measures].[Internet Sales Count] On 0,
NonEmpty([Customer].[Customer Geography].[English Country Region Name].Members) On
1
FROM [Adventure Works Cube]

9.

Click Execute.

10. Review the query results.


11. Close the query window, clicking No when prompted to save the query.

Task 4: Write an MDX query to return data on rows and columns


1.

Click New Query.

2.

Type the following MDX query:


SELECT
NonEmpty([Order Date].[Calendar Date].[Calendar Year].Members) ON COLUMNS,
[Customer].[Customer Geography].[City].Members ON ROWS
FROM [Adventure Works Cube]
WHERE [Measures].[Sales Amount - Internet Sales]

3.

Click Execute.

4.

Review the query results. Notice that the NonEmpty function eliminates any Year columns without
sales, but the lack of the NonEmpty function on the City results in null values on rows where there
are no sales.

5.

Close the query window, clicking No when prompted to save the query.

6.

Minimize SQL Server Management Studio. You will use it again in the next exercise.

Lab Answer Key: Introduction to MDX

Exercise 2: Creating a Calculated Member


Task 1: Define a Profit calculated member based on physical measures
1.

Browse to the D:\10778A\Labfiles\Lab08\Starter folder and double-click the Adventure Works


OLAP.sln project solution file to open the solution in SQL Server Data Tools.

2.

In Solution Explorer, right-click Adventure Works Cube.cube, click Open, and then click the
Calculations tab.

3.

On the toolbar of the Calculations tab, click the New Calculated Member icon.

4.

In the Name box, change the name of the calculated measure to [Profit].

5.

On the Calculations tab, in the Calculation Tools pane, on the Metadata tab, expand Measures, and
then expand Internet Sales to view the metadata for the Internet Sales measure group.

6.

Drag Sales Amount Internet Sales from the Metadata tab in the Calculation Tools pane into the
Expression box.

7.

In the Expression box, after [Measures].[Sales Amount Internet Sales], type a minus sign (-).

8.

On the Metadata tab in the Calculation Tools pane, drag Total Product Cost Internet Sales into
the Expression box after the minus sign (-).

9.

In the Format string list, select "Currency".

10. In the Non-empty behavior list, select the check boxes for Total Product Cost Internet Sales and
Sales Amount Internet Sales, and then click OK.
11. In the Associated measure group field, select Internet Sales.
12. On the File menu, click Save All.

Task 2: Define gross profit margin calculations


1.

In the Script Organizer pane, verify that [Profit] is selected, and then, on the toolbar of the
Calculations tab, click the New Calculated Member icon.

2.

In the Name box, change the name of this new calculated measure to [Gross Profit Margin].

3.

In the Expression box, create the following MDX expression.


([Measures].[Sales Amount Internet Sales] - [Measures].[Total Product Cost
Internet Sales])
/ [Measures].[Sales Amount Internet Sales]

4.

In the Format string list, select "Percent".

5.

In the Non-empty behavior list, select the check box for Sales Amount Internet Sales, and then
click OK.

6.

In the Associated measure group field, select Internet Sales.

7.

On the File menu, click Save All.

Lab Answer Key: Introduction to MDX

8.

On the Build menu, click Deploy Adventure Works OLAP. If you are prompted to replace the
existing database, click Yes.

9.

If the Account Password dialog box appears, in the Password box, type Pa$$w0rd.

10. Close SQL Server Data Tools.

Task 3: Query the new calculated members


1.

Maximize SQL Server Management Studio.

2.

Click New Query.

3.

Type the following MDX query.


SELECT
{[Measures].[Profit], [Measures].[Gross Profit Margin]} ON COLUMNS,
NonEmpty([Product].[Product Category].[English Product Category Name]) ON ROWS
FROM [Adventure Works Cube]

4.

Click Execute.

5.

Review the query results. Notice that the calculated members you defined in the cube are applied to
sales for the product categories.

6.

Close the query window, clicking No when prompted to save the query.

7.

Close SQL Server Management Studio.

Results: After this exercise, you should have created two calculated members and then queried them.

Lab Answer Key: Customizing Cube Functionality

Module 9
Lab Answer Key: Customizing Cube Functionality
Contents:
Exercise 1: Implementing an Action

Exercise 2: Implementing a Perspective

Exercise 3: Implementing a Translation

Lab Answer Key: Customizing Cube Functionality

Lab 9: Customizing a Cube


Exercise 1: Implementing an Action
Task 1: Prepare the lab environment
1.

Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to
MIA-SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab09, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab09\Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd) and click Run as administrator.

5.

Click Yes when prompted to confirm you want to run the command file, and wait for the script to
finish.

Task 2: Deploy an OLAP database


1.

In the D:\10778A\Labfiles\Lab09\Starter folder and double-click the Adventure Works OLAP.sln


solution file.

2.

In the Solution Explorer pane, right-click Adventure Works OLAP, and then click Deploy.

3.

If the Account Password dialog box appears, in the Password box, type Pa$$w0rd and click OK.

4.

Keep SQL Server Data Tools open. You will use it in the next task.

Task 3: Create a drillthrough action


1.

In SQL Server Data Tools, in Solution Explorer right-click Adventure Works Cube.cube and click
View Designer.

2.

In Cube Designer for the Adventure Works cube, click the Actions tab.

3.

On the toolbar of the Actions tab, click the New Drillthrough Action icon.

4.

In the Name box, change the name of this action to Internet Sales Details Drillthrough Action.

5.

In the Measure group members list, click Internet Sales.

6.

In the Drillthrough Columns box, in the Select Dimensions list, click Customer; and then in the
Return Columns list, select English Country Region Name and Full Name, and click OK.

7.

Repeat the previous step to add the following dimensions and return columns:
Dimension

8.

Return Columns

Order Date

Simple Date

Product

English Product Name

Expand Additional Properties.

Lab Answer Key: Customizing Cube Functionality

9.

In the Caption box, type Drillthrough to Order Details.

10. On the File menu, click Save All.


11. In the Solution Explorer pane, right-click Adventure Works OLAP, and then click Deploy.

Task 4: Browse a drillthrough action


1.

In SQL Server Data Tools, in the Adventure Works Cube.cube designer, click the Browser tab.

2.

Click the Analyze in Excel icon to create an Excel workbook with a connection to cube. If a security
notice is displayed, click Enable.

3.

In Excel, in the PivotTable Field List pane, under Internet Sales, select Sales Amount.

4.

In the PivotTable Field List pane, under Order Date, select Order Date.Calendar Date.

5.

In the PivotTable Field List pane, under Product, select Product Category.

6.

In the PivotTable, right-click the sales amount for Bikes in 2003 (cell D4), point to Additional
Actions, and click Drillthrough to order details.

7.

View the new worksheet generated by the drillthrough action, noting that it shows the country,
customer name, order date, and product name for each sale of a bike in 2003.

8.

Close Excel without saving your changes.

9.

Keep SQL Server Data Tools open for the next exercise.

Lab Answer Key: Customizing Cube Functionality

Exercise 2: Implementing a Perspective


Task 1: Define a Sales Summary perspective
1.

In SQL Server data Tools, in the Cube Designer for the Adventure Works cube, click the
Perspectives tab.

2.

On the toolbar of the Perspectives tab, click the New Perspective icon.

3.

Change the name of the new perspective to Sales Summary.

4.

Clear the check boxes for all measures in the Internet Sales measure group other than Sales
Amount Internet Sales.

5.

Clear the check boxes for all dimensions other than Customer.

6.

Clear the checkbox for all actions and calculated members.

7.

On the File menu, click Save All.

Task 2: Browse the cube using the Sales Summary perspective


1.

On the SQL Server Data Tools Build menu, click Deploy Adventure Works OLAP.

2.

When deployment has successfully completed, switch to the Browser tab, and then click the
Reconnect icon.

3.

If there is any data in the Data pane, right-click in the data area and then click Clear Grid. If there are
any dimensions in the Filter pane, right-click each dimension and click Delete.

4.

In the Cube Selection area above the Metadata pane, click the ellipses (), click Sales Summary,
and click OK.

5.

In the Measure Group pane, expand Measures, expand Internet Sales. Note that the only measure
displayed is Sales Amount and the only dimension displayed is Customer. This enables users in the
sales department to focus on the data that is useful to them.

6.

Drag the Sales Amount Internet Sales measure to the Drag levels or measures here to add to
the query pane.

7.

In the Measure Group pane, expand the Customer dimension and drag the Gender Marital Status
hierarchy to the left of Sales Amount Internet Sales.

8.

Note that users can browse the data in the perspective in the same way they browse data in the
whole cube.

9.

In the Cube Selection field, click the ellipses (), click Adventure Works Cube, and click OK. Note
that all measures and dimensions are now visible.

10. Keep SQL Server Data Tools open for the next exercise.

Lab Answer Key: Customizing Cube Functionality

Exercise 3: Implementing a Translation


Task 1: Specify translations for the Time Dimension metadata
1.

In Solution Explorer, in the Dimensions folder, right-click Date.dim, click View Designer, and then
click the Translations tab.

2.

On the toolbar of the Translations tab, click the New Translation icon. Then, in the Select
Language dialog box, click French (France), and click OK.

3.

In the row for the Caption object for the Date dimension, type Date in the French (France)
translation column.

4.

In the row for the Caption object for the Month Number of Year attribute, type Mois d'Anne in
the French (France) translation column.
Tip To type hold the Alt key and type 130 using the number pad on your keyboard
ensuring NumLock is turned on. If this is not possible type the captions without accents.

5.

Click the ellipses () button for the French (France) translation for the Month Number of Year
attribute. The Attribute Data Translation dialog box appears.

6.

In the Translation columns list, click FrenchMonthName, and then click OK.

7.

On the File menu, click Save All.

8.

Close the Date.dim dimension designer.

Task 2: Specify translations for the Adventure Works cube metadata


1.

In Solution Explorer right-click Adventure Works Cube.cube and click View Designer.

2.

In the Adventure Works Cube.cube designer, click the Translations tab.

3.

On the toolbar of the Translations tab, click the New Translation icon, and then in the Select
Language dialog box, click French (France). Then click OK.

4.

In the row for the Caption object for the Internet Sales measure group, in the French (France)
translation column, type Ventes d'Internet.

5.

In the row for the Caption object for the Sales Amount measure, in the French (France) translation
column, type Ventes Total.

6.

On the File menu, click Save All.

Task 3: Browse the cube using the new translations


1.

On the Build menu of SQL Server Data Tools, click Deploy Adventure Works OLAP. Then, when
deployment has successfully completed, click the Browser tab, and then click Reconnect.

2.

If there is any data in the Data pane, right-click in the data area and then click Clear Grid. If there are
any dimensions in the Filter pane, right-click each dimension and click Delete.

3.

On the toolbar, in the Language list, click French (France).

4.

In the Measure Group pane, expand Measures, expand Ventes dInternet, and drag Ventes Total to
the Drag levels or measures here to add to the query pane.

5.

In the Measure Group field, expand the Order Date dimension and drag the Order Date.Mois
dAnne hierarchy to the left of Ventes Total and note that the caption and data is now in French.

Lab Answer Key: Implementing a Tabular Data Model with Microsoft PowerPivot

Module 10
Lab Answer Key: Implementing a Tabular Data Model with
Microsoft PowerPivot
Contents:
Exercise 1: Creating a Tabular Data Model by Using PowerPivot for Excel

Exercise 2: Using a Tabular Data Model in Excel

Exercise 3: Sharing a PowerPivot Workbook to PowerPivot Gallery

10

Exercise 4: Using a PowerPivot Workbook as a Data Source

11

Lab Answer Key: Implementing a Tabular Data Model with Microsoft PowerPivot

Lab 10: Using PowerPivot for Excel


Exercise 1: Creating a Tabular Data Model by Using PowerPivot for Excel
Task 1: Prepare the lab environment
1.

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to
MIA-SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab10, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab10\Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd), and then click Run as
administrator.

5.

Click Yes when prompted to confirm that you want to run the command file, and then wait for the
script to finish.

Task 2: Import data into a PowerPivot for Excel workbook


1.

Click Start, point to All Programs, click Microsoft Office, and then click Microsoft Excel 2010.

2.

In Microsoft Excel 2010, on the ribbon, click the PowerPivot tab.

3.

On the ribbon, click PowerPivot Window.

4.

In the PowerPivot window, on the Home tab, in the Get External Data group, click From Database,
and then click From SQL Server.

5.

In the Table Import Wizard, on the Connect to a Microsoft SQL Server Database page, in the
Friendly connection name box, type AdventureWorksDW.

6.

In the Server name box, type localhost.

7.

In the Log on to the server box, ensure that Use Windows Authentication is selected.

8.

In the Database name list, click AdventureWorksDW, and then click Next.

9.

On the Choose How to Import the Data page, click Select from a list of tables and views to
choose the data to import, and then click Next.

10. On the Select Tables and Views page, select the FactResellerSales check box.
11. Click Select Related Tables to import other tables that are directly related to the FactResellerSales
table.
12. Deselect the check boxes for the DimCurrency, DimPromotion, and DimReseller tables.
13. Select the DimProductSubcategory and DimProductCategory tables. These tables were not added
automatically because they are not directly related to the FactResellerSales table.

Lab Answer Key: Implementing a Tabular Data Model with Microsoft PowerPivot

14. In the Friendly Name column, change the friendly names of the selected tables as follows:

DimDate: Date

DimEmployee: Employee

DimProduct: Product

DimProductCategory: Product Category

DimProductSubcategory: Product Subcategory

DimSalesTerritory: Sales Territory

FactResellerSales: Reseller Sales

15. Click the DimDate row to select it, and then click the Preview & Filter button.
16. On the Preview Selected Table page, uncheck the following columns, and then click OK:

SpanishDayNameOfWeek

FrenchDayNameOfWeek

SpanishMonthName

FrenchMonthName

17. Remove the following columns from the DimEmployee table in the same way, and then click OK:

LoginID

EmailAddress

Phone

EmergencyContactName

EmergencyContactPhone

18. Remove the following columns from the DimProduct table in the same way, and then click OK:

SpanishProductName

FrenchProductName

FrenchDescription

ChineseDescription

ArabicDescription

HebrewDescription

ThaiDescription

GermanDescription

JapaneseDescription

TurkishDescription

Lab Answer Key: Implementing a Tabular Data Model with Microsoft PowerPivot

19. Remove the following columns from the DimProductCategory table in the same way, and then click
OK:

SpanishProductCategoryName

FrenchProductCategoryName

20. Remove the following columns from the DimProductSubcategory table in the same way, and then
click OK:

SpanishProductSubcategoryName

FrenchProductSubcategoryName

21. In the Table Import Wizard, click Finish.


22. When the data import completes, in the Message column, click Details, and then review the details
of the import process. Note that there is an error relating to the DimEmployee table that states that
self-referential relationships are not supported.
23. In the Details box, click OK.
24. In the Table Import Wizard, click Close.
25. On the taskbar, click the Save button. In the Save As dialog box, navigate to the
D:\10778A\Labfiles\Lab10\Starter folder, in the File name box, type Sales Overview, and then click
Save.
Note When importing tables, it is best practice to remove all columns that you do not
require. This can substantially improve the performance of the Microsoft PowerPivot
workbook.

Task 3: Rename columns in a PowerPivot for Excel workbook


1.

In the PowerPivot window, click the Date tab in the lower-left corner to select the Date table.

2.

Double-click the EnglishDayNameOfWeek column header, type Day, and then press Enter.

3.

Rename the columns in the following table in the same way:


Table name

Existing column name

New column name

Date

EnglishMonthName

Month

Date

CalendarYear

Calendar Year

Date

FiscalYear

Fiscal Year

Employee

FirstName

First Name

Employee

LastName

Last Name

Product

EnglishProductName

Product

Product Category

EnglishProductCategoryName

Category

Lab Answer Key: Implementing a Tabular Data Model with Microsoft PowerPivot

(continued)
Table name

Existing column name

New column name

Product Subcategory

EnglishProductSubcategoryName

Subcategory

Sales Territory

SalesTerritoryCountry

Country

Reseller Sales

TotalProductCost

Total Product Cost

Reseller Sales

SalesAmount

Sales Amount

Note You should consider renaming all columns that you expect to use in the workbook
for ease of understanding and clarity.

Task 4: Import data into a PowerPivot workbook by using a query


1.

In the PowerPivot window, on the Home tab, in the Get External Data group, click From Database,
and then click From SQL Server.

2.

In the Friendly connection name dialog box, type AdventureWorksDWGeography.

3.

In the Server name box, type localhost.

4.

In the Log on to the server box, ensure that Use Windows Authentication is selected.

5.

In the Database name list, click AdventureWorksDW, and then click Next.

6.

On the Choose How to Import the Data page, click Write a query that will specify the data to
import, and then click Next.

7.

In the Specify a SQL Query window, click Design.

8.

In the Design window, in the Database view pane, expand Tables, and then select DimGeography.

9.

In the Selected fields area, click IpAddressLocator, and then click the Delete Field button to
remove this column from the imported table.

10. Remove the SpanishCountryRegionName, FrenchCountryRegionName, and PostalCode columns


in the same way, and then click OK.
11. In the Specify a SQL Query window, click Validate, and then click Finish.
12. When the data import completes, in the Table Import Wizard, click Close.
13. In the PowerPivot window, at the bottom, right-click the Query tab, click Rename, type Geography,
and then press Enter.

Task 5: Create a relationship manually


1.

In the PowerPivot window, on the ribbon, in the View group, click Diagram View.

2.

If necessary, rearrange the tables so that you can see the Sales Territory and Geography tables at
the same time.

3.

In the Sales Territory table, click SalesTerritoryKey, drag it to SalesTerritoryKey in the Geography
table, and then release it.

Lab Answer Key: Implementing a Tabular Data Model with Microsoft PowerPivot

Task 6: Create a hierarchy


1.

In the PowerPivot window, on the ribbon, in the View group, click Data View.

2.

Click the Product table tab.

3.

Scroll across to the final column in the table, double-click the Add Column header, type
Subcategory, and then press Enter.

4.

Below the ribbon, in the formula bar, type the following Data Analysis Expressions (DAX) formula, and
then press Enter:
=RELATED('Product Subcategory'[Subcategory])

5.

Not all rows in the Products table have a value for the Subcategory column. Use the scroll bar to
scroll down the Subcategory column until you see the rows that have an value for Subcategory.

6.

In the column to the right of Subcategory, double-click the Add Column header, type Category,
and then press Enter.

7.

Below the ribbon, in the formula bar, type the following DAX formula, and then press Enter:
=RELATED('Product Category'[Category])

8.

On the ribbon, in the View section, click the Diagram View button.

9.

In the Product table, right-click the Product table header, click Create Hierarchy, type Products,
and then press Enter.

10. In the Product table, click Category, drag it onto the Products hierarchy, and then release it.
11. In the Product table, click Subcategory, drag it onto the Products hierarchy, and then release it.
12. In the Product table, click Product, drag it onto the Products hierarchy, and then release it. (You
may need to resize the table to do this.)

Task 7: Hide tables from client tools


1.

In the PowerPivot window, click the Data View button.

2.

Right-click the Product Category table tab, and then click Hide from Client Tools.

3.

Right-click the Product Subcategory table tab, and then click Hide from Client Tools.

4.

On the taskbar, click the Save button.

Lab Answer Key: Implementing a Tabular Data Model with Microsoft PowerPivot

Exercise 2: Using a Tabular Data Model in Excel


Task 1: Create a PivotTable table
1.

In the PowerPivot window, in the upper-left corner, click Switch to Workbook.

2.

Click Sheet 1, and then click in cell B2.

3.

On the ribbon, on the PowerPivot tab, click PivotTable, and then click PivotTable.

4.

In the Create PivotTable dialog box, click Existing Worksheet, and then click OK.

5.

In the PowerPivot Field List, expand Reseller Sales, and then select Sales Amount and Total
Product Cost to add these columns to the Values area.
Note You can also drag columns into the Values area and other areas under the
PowerPivot Field List.

6.

In the PowerPivot Field List, expand Product, and then select Products (this is the hierarchy that
you created in Exercise 1).

Task 2: Create a measure


1.

In the PowerPivot Field List, right-click Reseller Sales, and then click Add New Measure.

2.

In the Measure name (all PivotTables) field, type Total Profit.

3.

In the Formula box, after the equal sign (=), type the following DAX formula:
SUM('Reseller Sales'[Sales Amount]) SUM('Reseller Sales'[Total Product Cost])

4.

In the Category list, select Currency, and then click OK.

Task 3: Add formatting to a PivotTable table


1.

On the ribbon, in the PivotTable Tools group, click the Design tab.

2.

In the PivotTable Styles area, click any style.

3.

In the Layout area, click Blank Rows, and then click Insert Blank Line after Each Item.

4.

On the ribbon, click the Home tab.

5.

In the PivotTable table, select all of the rows in the Total Profit column (do not include the Total
Profit header row).

6.

In the Styles area, click Conditional Formatting, click Color Scales, and then click GreenYellowRed Color Scale.

7.

In the PivotTable table, in the Row Labels column, expand Bikes, and then expand Road Bikes to
view the effects of the formatting options that you configured.

Task 4: Create PivotChart charts


1.

In the Sales Overview workbook, on Sheet 1, click in cell G9, and then click the PowerPivot tab.

2.

Click PivotTable, click PivotChart, in the Create PivotChart dialog box, click Existing Worksheet,
and then click OK.

Lab Answer Key: Implementing a Tabular Data Model with Microsoft PowerPivot

3.

In the PowerPivot Field List, expand Reseller Sales, and then select Sales Amount.

4.

Expand Product, and then select Category to add it to the Axis Fields area.

5.

Expand Date, and then drag Calendar Year to the Legend Fields area.

6.

On the ribbon, in the PivotChart Tools group, click the Layout tab.

7.

In the Labels area, click Chart Title, click Above Chart, and then type Sales Amount by Category
by Year.

8.

Click the PivotChart chart, and then click the Format tab.

9.

In the Size area, in the Height field, type 4.

10. In the Width field, type 6.


11. In the Shape Styles area, click any of the shape styles.
12. Click in cell G30, and then click the PowerPivot tab.
13. Click PivotTable, click PivotChart, in the Create PivotChart dialog box, click Existing Worksheet,
and then click OK.
14. In the PowerPivot Field List, expand Reseller Sales, and then select Sales Amount.
15. Expand Sales Territory, and then select Country.
16. Repeat steps 611 above to make the changes in the following table to the PivotChart chart:
Formatting option

Setting

Shape Height

3.5

Shape Width

Shape Style

Any shape style

Chart Title

Sales Amount by Country

17. Right-click the PivotChart chart, and then click Change Chart Type.
18. In the Change Chart Type window, click Exploded pie in 3-D, and then click OK.

Task 5: Add slicers


1.

Click cell B2 to select the PivotTable table that you created in Task 1. If your PivotTable table is not in
cell B2, click anywhere in your PivotTable table to select it.

2.

In the PowerPivot Field List, expand Sales Territory, and then drag Country to the Slicers
Horizontal area.

3.

Expand Date, and then drag Calendar Year to the Slicers Horizontal area.

4.

In the Country slicer, click Australia. The values in the PivotTable table update to show the totals for
Australia only. Note that the two PivotChart charts do not update.

5.

In the Country slicer, click Clear Filter.

6.

In the Calendar Year slicer, click 2003. The values in the PivotTable table update to show the totals
for 2003 only. Note that the two PivotChart charts do not update.

Lab Answer Key: Implementing a Tabular Data Model with Microsoft PowerPivot

7.

In the Calendar Year slicer, click Clear Filter.

8.

Right-click the Calendar Year slicer, click PivotTable Connections, select PivotTable2 and
PivotTable3, and then click OK. This associates the slicer with the two PivotChart charts.

9.

In the Calendar Year slicer, click 2003. Note that the PivotTable table and both PivotChart charts
update.

10. In the Calendar Year slicer, click Clear Filter.


11. Right-click the Country slicer, click PivotTable Connections, select PivotTable2, and then click OK.
12. In the Country slicer, click Australia. Note that the PivotTable table and the Sales Amount by
Category by Year PivotChart chart both update, but the Sales Amount by Country PivotChart chart
does not.
13. In the Country slicer, click Clear Filter.
14. On the taskbar, click the Save button, and then close Sales Overview.xlsx.

10

Lab Answer Key: Implementing a Tabular Data Model with Microsoft PowerPivot

Exercise 3: Sharing a PowerPivot Workbook to PowerPivot Gallery


Task 1: Upload a PowerPivot for Excel workbook to PowerPivot Gallery
1.

Click Start, and then click Internet Explorer and browse to the SharePoint site at http://mia-sqlbi.

2.

In Internet Explorer, on the Adventure Works Portal - Home web page, in the Libraries list, click
PowerPivot Gallery.

3.

Click the Documents tab, click Upload Document, and then click Upload Document.

4.

In the PowerPivot Gallery Upload Document dialog box, click Browse.

5.

In the File name box, navigate to D:\10778A\Labfiles\Lab10\Starter, click Sales Overview.xlsx and
then click Open.

6.

In the PowerPivot Gallery Upload Document dialog box, click OK.

7.

If the PowerPivot Gallery Sales Overview.xlsx dialog box appears, click Save.

Task 2: Open a PowerPivot for Excel workbook from PowerPivot Gallery


1.

On the PowerPivot Gallery web page, click the large Sales Overview icon.

2.

Use the Calendar Year and Country slicers to modify the data that is displayed in the PivotTable
table and PivotChart charts.

3.

Close Internet Explorer.

Lab Answer Key: Implementing a Tabular Data Model with Microsoft PowerPivot

11

Exercise 4: Using a PowerPivot Workbook as a Data Source


Task 1: Connect to a PowerPivot workbook in PowerPivot Gallery and use it to create
a PivotTable table in Excel
1.

Click Start, point to All Programs, click Microsoft Office, and then click Microsoft Excel 2010.

2.

In the new workbook, on the ribbon click the Data tab, click Get External Data, click From Other
Sources, and then click From Analysis Services.

3.

In the Data Connection Wizard dialog box, on the Connect to Database Server page, in the Server
name field, type http://localhost/PowerPivot Gallery/Sales Overview.xlsx, and then click Next.

4.

On the Select Database and Table page, click Next.

5.

On the Save Data Connection File and Finish page, click Finish.

6.

In the Import Data dialog box, click OK.

7.

In the PivotTable Field List, expand Reseller Sales if necessary, and then select Sum of Sales
Amount.

8.

Expand Employee if necessary, select Last Name, and then review the data in the PivotTable table.

9.

Click File, and then click Close.

10. In the Microsoft Excel dialog box, click Dont Save.


11. Close Excel and then close Internet Explorer.

Lab Answer Key: Introduction to DAX

Module 11
Lab Answer Key: Introduction to DAX
Contents:
Exercise 1: Creating Calculated Columns

Exercise 2: Creating Measures

Exercise 3: Using Time Intelligence

Exercise 4: Creating a Dynamic Measure

Lab Answer Key: Introduction to DAX

Lab 11: Creating Calculated Columns and


Measures by Using DAX
Exercise 1: Creating Calculated Columns
Task 1: Prepare the lab environment
1.

Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to
MIA-SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab11, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab11\Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd), and then click Run as
administrator.

5.

Click Yes when prompted to confirm that you want to run the command file, and then wait for the
script to finish.

Task 2: Create a calculated column by using concatenation


1.

Navigate to the D:\10778A\Labfiles\Lab11\Starter folder, and then double-click the Sales


Overview.xlsx file.

2.

In the Sales Overview workbook, click the PowerPivot tab, and then on the Microsoft PowerPivot
ribbon, click PowerPivot Window.

3.

In the PowerPivot window, click the Employee tab to view the Employee table.

4.

In the Employee table, scroll across to the last column, double-click Add Column, type Full Name,
and then press Enter.

5.

In the formula bar above the Employee table, type the DAX formula in the following code example,
and then press Enter:
=CONCATENATE('Employee'[First Name], CONCATENATE(" ", 'Employee'[Last Name]))

Task 3: Create calculated columns to support parent-child relationships


1.

In the Employee table, scroll across to the last column, and then double-click Add Column.

2.

In the Add Column column header, type Path, and then press Enter.

3.

In the formula bar above the Employee table, type the DAX formula in the following code example,
and then press Enter:
=PATH([EmployeeKey], [ParentEmployeeKey])

4.

Double-click Add Column, in the Add Column column header, type Employee Level 1, and then
press Enter.

Lab Answer Key: Introduction to DAX

5.

In the formula bar above the Employee table, type the DAX formula in the following code example,
and then press Enter:
=LOOKUPVALUE('Employee'[Full Name], 'Employee'[EmployeeKey], PATHITEM([Path], 1))

6.

Double-click Add Column, in the Add Column column header, type Employee Level 2, and then
press Enter.

7.

In the formula bar above the Employee table, type the DAX formula in the following code example,
and then press Enter:
=LOOKUPVALUE('Employee' [Full Name], 'Employee' [EmployeeKey], PATHITEM([Path], 2))

8.

Double-click Add Column, in the Add Column column header, type Employee Level 3, and then
press Enter.

9.

In the formula bar above the Employee table, type the DAX formula in the following code example,
and then press Enter:
=LOOKUPVALUE('Employee' [Full Name], 'Employee' [EmployeeKey], PATHITEM([Path], 3))

10. Double-click Add Column, in the Add Column column header, type Employee Level 4, and then
press Enter.
11. In the formula bar above the Employee table, type the DAX formula in the following code example,
and then press Enter:
=LOOKUPVALUE('Employee' [Full Name], 'Employee' [EmployeeKey], PATHITEM([Path], 4))

12. Click the Path column header, hold down Shift, and then click the Employee Level 1, Employee
Level 2, Employee Level 3, and Employee Level 4 column headers to multiselect them.
13. Right-click the Employee Level 4 column header, and then click Hide from Client Tools.

Task 4: Create a hierarchy that uses calculated columns


1.

On the ribbon, in the View group, click Diagram View.

2.

In the Employee table, right-click the Employee table header, click Create Hierarchy, type
Employees, and then press Enter.

3.

In the Employee table, click Employee Level 1, drag it onto the Employees hierarchy, and then
release it. (You may need to resize the table to do this.)

4.

In the Employee table, click Employee Level 2, drag it onto the Employees hierarchy, and then
release it.

5.

In the Employee table, click Employee Level 3, drag it onto the Employees hierarchy, and then
release it.

6.

In the Employee table, click Employee Level 4, drag it onto the Employees hierarchy, and then
release it.

Lab Answer Key: Introduction to DAX

Task 5: Create a PivotTable table that contains the Employees hierarchy


1.

In the PowerPivot window, in the upper-left corner, click the Switch to Workbook button.

2.

In the Microsoft Excel workbook, right-click the Sheet2 tab, click Rename, type Employee Sales, and
then press Enter.

3.

Click in cell B1, on the ribbon, on the PowerPivot tab, click PivotTable, and then click PivotTable.

4.

In the Create PivotTable dialog box, click Existing Worksheet, and then click OK.

5.

In the PowerPivot Field List, expand Employee, and then drag the Employees hierarchy to the Row
Labels area.

6.

Expand Reseller Sales, and then select Sales Amount to add it to the Values area.

7.

In the PivotTable table, in the Row Labels column, expand Ken Sanchez, expand Brian Welcker, and
then expand Amy Alberts.

8.

Right-click Ken Sanchez, click Show/Hide Fields, and then click Employee Level 1 to clear it.

9.

Right-click Brian Welcker, click Show/Hide Fields, and then click Employee Level 2 to clear it.

10. Click File, and then click Save.

Lab Answer Key: Introduction to DAX

Exercise 2: Creating Measures


Task 1: Create a measure that calculates total sales for all employees
1.

In the Sales Overview.xlsx Excel workbook, click any cell in the PivotTable on the Employee Sales
worksheet, and in the PowerPivot Field List, right-click Reseller Sales, and then click Add New
Measure.

2.

In the Measure Settings dialog box, in the Measure Name (all PivotTables) field, type Total Sales
for All Employees.

3.

In the Formula field, type the formula in the following code example after the equals sign (=), and
then click Check Formula:
CALCULATE([Sum of Sales Amount], ALL('Employee'))

4.

In the Category field, click Currency, and then click OK.

5.

In the PowerPivot Field List, in Reseller Sales, clear Total Sales for All Employees.

Task 2: Create a measure that calculates percentage of sales per employee


1.

In the PowerPivot Field List, right-click Reseller Sales, and then click Add New Measure.

2.

In the Measure Settings dialog box, in the Measure Name (all PivotTables) field, type Percentage
of Sales.

3.

In the Formula field, type the formula in the following code example after the equals sign (=):
[Sum of Sales Amount]/[Total Sales for All Employees]

4.

In the Category field, click Number, in the Format field, select Percentage, and then click OK.

Task 3: Add conditional formatting to the PivotTable table


1.

In the PivotTable table, expand Stephen Jiang and Syed Abbas.

2.

Select all of the rows in the Percentage of Sales column, but do not include the column header or
the Grand Total row value.

3.

Click the Home tab, in the Styles area, click Conditional Formatting, click Data Bars, and then
under Gradient Fill, click Blue Data Bar.

4.

Click File, and then click Save.

Lab Answer Key: Introduction to DAX

Exercise 3: Using Time Intelligence


Task 1: Create a measure that uses a time intelligence function
1.

Click the PowerPivot tab, and then click PowerPivot Window.

2.

If necessary, on the ribbon, in the View group, click Data View. Click the Date tab to select the Date
table, and then on the ribbon, click the Design tab.

3.

Click Mark as Date Table, and then click Mark as Date Table.

4.

In the Mark as Date Table dialog box, in the Date field, ensure that FullDateAlternateKey is
selected, and then click OK.

5.

Click the Switch to Workbook button.

6.

Click the PowerPivot tab, click PivotTable, and then click PivotTable.

7.

In the Create PivotTable dialog box, ensure New Worksheet is selected, and click OK.

8.

Right-click the new worksheet tab, click Rename, type Year on Year Growth, and then press Enter.

9.

In the PivotTable Field List, expand Date, and then drag Calendar Year to the Row Labels area.

10. Expand Reseller Sales, and then select Sales Amount.


11. Right-click Reseller Sales, and then click Add New Measure.
12. In the Measure Settings dialog box, in the Measure Name (all PivotTables) field, type Previous
Year.
13. In the Formula field, type the formula in the following code example after the equals sign (=):
CALCULATE([Sum of Sales Amount], DATEADD('Date'[FullDateAlternateKey], -1, YEAR))

14. In the Category field, click Currency, and then click OK.
15. In the PowerPivot Field List, in Reseller Sales, clear Previous Year.

Task 2: Create a measure that uses conditional logic


1.

In the PowerPivot Field List, right-click Reseller Sales, and then click Add New Measure.

2.

In the Measure Settings dialog box, in the Measure Name (all PivotTables) field, type Year on
Year Growth.

3.

In the Formula field, type the formula in the following code example after the equals sign (=):
IF([Previous Year], ([Sum of Sales Amount] - [Previous Year])/[Previous Year],
BLANK())

4.

In the Category field, click Number, in the Format field, select Percentage, and then click OK.
Note

You will use the Year on Year Growth measure in the next exercise.

Lab Answer Key: Introduction to DAX

Exercise 4: Creating a Dynamic Measure


Task 1: Create a linked table
1.

Click the Time Period worksheet tab.

2.

Select cells A1 to A4, click the PowerPivot tab, and then click Create Linked Table.

3.

In the Create Table dialog box, select My table has headers, and then click OK.

4.

In the PowerPivot window, right-click the Table 1 tab, click Rename, type Time Period, and then
press Enter.

Task 2: Create a measure that checks whether inputs have a single value
1.

In the PowerPivot window, in the upper-left corner, click the Switch to Workbook button.

2.

Click the Time Period worksheet tab, click the PowerPivot tab, click PivotTable, and then click
PivotTable.

3.

In the Create PivotTable dialog box, click OK.

4.

Right-click the new worksheet tab, click Rename, type Dynamic Time, and then press Enter.

5.

In the PowerPivot Field List, expand Time Period, and then drag Period to the Row Labels area.

6.

Expand Date, and then drag Calendar Year to the Column Labels area.

7.

Right-click Reseller Sales, and then click Add New Measure.

8.

In the Measure Settings dialog box, in the Measure Name (all PivotTables) field, type Check
Single Values.

9.

In the Formula field, type the formula in the following code example after the equals sign (=), and
then click OK:
IF(HASONEVALUE('Time Period'[Period]) && HASONEVALUE('Date'[Calendar Year]), TRUE(),
FALSE())

10. In the PowerPivot Field List, in Reseller Sales, clear Check Single Values.

Task 3: Create a measure that dynamically calculates values


1.

In the PowerPivot Field List, right-click Reseller Sales, and then click Add New Measure.

2.

In the Measure Settings dialog box, in the Measure Name (all PivotTables) field, type Sales Over
Time.

3.

In the Formula field, type the formula in the following code example after the equals sign(=):
IF([Check Single Values], SWITCH(VALUES('Time Period'[Period]), "Current Year", [Sum
of Sales Amount], "Previous Year", [Previous Year], "YOY Growth",
IF(NOT(ISBLANK([Previous Year])), [Sum of Sales Amount] [Previous Year], BLANK())),
BLANK())

4.

In the Category field, click Currency, and then click OK.

5.

Click File, click Save, and then close the Sales Overview workbook.

Lab Answer Key: Implementing an Analysis Services Tabular Data Model

Module 12
Lab Answer Key: Implementing an Analysis Services Tabular
Data Model
Contents:
Exercise 1: Creating an Analysis Services Tabular Data Model Project
from a PowerPivot Workbook

Exercise 2: Implementing a Perspective

Exercise 3: Implementing Partitions

Exercise 4: Deploying an Analysis Services Tabular Data Model

Exercise 5: Enabling Access to a Tabular Data Model

Exercise 6: Configuring DirectQuery Storage Mode

Exercise 7: Implementing Security in a Tabular Data Model

10

Lab Answer Key: Implementing an Analysis Services Tabular Data Model

Lab 12: Working with an Analysis Services


Tabular Data Model
Exercise 1: Creating an Analysis Services Tabular Data Model Project from a
PowerPivot Workbook
Task 1: Prepare the lab environment
1.

Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to
MIA-SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab12, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab12\Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd) and click Run as administrator.

5.

Click Yes when prompted to confirm you want to run the command file, and wait for the script to
finish.

Task 2: Review the Reseller Sales Analysis PowerPivot workbook


1.

In the D:\10778A\Labfiles\Lab12\Starter folder, double-click the file Reseller Sales Analysis.xlsx. This
workbook does not contain any PivotTable tables or PivotChart charts, but it does contain PowerPivot
data.

2.

In the Reseller Sales Analysis.xlsx workbook, click the PowerPivot tab, and then click PowerPivot
Window. The PowerPivot window opens behind the workbook, so minimize the workbook to see it.

3.

In the PowerPivot window, note that there are no linked tables in the Tabular Data Model.

4.

Click on the Employee tab. Note that the Employee table does not contain any calculated columns.
Repeat this step for the other tables.

5.

Close the PowerPivot window, and then close the Reseller Sales Analysis.xlsx workbook. If you are
prompted to save the changes to the workbook, click Dont Save.

Task 3: Create a tabular data model project by using SQL Server Data Tools
1.

Click Start, click All Programs, click Microsoft SQL Server 2012, and then click SQL Server SQL
Server Data Tools.

2.

On the Start Page tab, click New Project.

3.

In the New Project dialog box, in the Installed Templates pane, expand Business Intelligence, click
Analysis Services, and then click Import from PowerPivot.

4.

In the Name box, type Reseller Sales, and then click Browse to select the
D:\10778A\Labfiles\Lab12\Starter folder.

5.

In the New Project dialog box, click OK.

Lab Answer Key: Implementing an Analysis Services Tabular Data Model

6.

If the Workspace and Deployment Server Configuration dialog box appears, in the Default Server
list, select localhost\SQL2, and then click OK. If you have previously configured this setting, you will
not be prompted (you can change the setting in the Analysis Services section of the tool options for
SQL Server Data Tools.)

7.

In the Open dialog box, navigate to the D:\10778A\Labfiles\Lab12\Starter folder, click Reseller Sales
Analysis.xlsx, and then click Open. When prompted to import the metadata but not the data, click
Yes. Then wait until the creation of the Reseller Sales project completes.

Task 4: Set the impersonation account for the data connection


1.

On the Model menu, click Existing Connections.

2.

In the Existing Connections dialog box, ensure the connection to the AdventureWorksDW
database is selected and click Edit, and then in the Edit Connection dialog box, click Impersonation.

3.

In the Impersonation Information dialog box, click Specific Windows user name and password,
in the User Name field, type ADVENTUREWORKS\ServiceAcct, in the Password field, type
Pa$$w0rd, and then click OK.

4.

In the Edit Connection dialog box, click Save, and then in the Existing Connections dialog box,
click Process.

5.

In the Data Processing dialog box, after all of the tables have been processed, click Close. Then in
the Existing Connections dialog box, click Close. The model now shows the data in each table.

Task 5: Explore the workspace database


1.

Click Start, click All Programs, click Microsoft SQL Server 2012, and then click SQL Server
Management Studio.

2.

In the Connect to Server dialog box, in the Server Type list, select Analysis Services, in the Server
Name dialog box, type localhost\SQL2, and then click Connect.

3.

In Object Explorer, expand localhost\SQL2, expand Databases, and then expand the workspace
database, which has a name that begins Reseller Sales_Student.
Note Workspace databases for Tabular Data Model projects have a GUID in their name.
The exact value of the GUID will vary between different computers, and consequently, so
will the name of the workspace database.

4.

Expand Tables and examine the tables in the workspace database. Note that they are the same as the
tables in the Reseller Sales Analysis.xlsx PowerPivot workbook that you used to create the Reseller
Sales project.

5.

Minimize SQL Server Management Studio.

Lab Answer Key: Implementing an Analysis Services Tabular Data Model

Exercise 2: Implementing a Perspective


Task 1: Create measure calculations
1.

In SQL Server Data Tools, on the Reseller Sales table tab, click the column header for the
SalesAmount column and then on the Column menu, point to AutoSum, and click Sum. This
creates a measure calculation for the SalesAmount column.

2.

Repeat the previous step to create a Sum measure calculation for the TotalProductCost column.
Then on the File menu, click Save All.

3.

On the Model menu, point to Process and click Process All. In the Data Processing dialog, when
processing is complete. Click Close.

Task 2: Create a perspective


1.

In SQL Server Data Tools, on the Model menu, click Perspectives.

2.

In the Perspectives dialog box, click New Perspective.

3.

Press Delete to delete the text New Perspective, type No Employee Data and then press Enter.

4.

In the No Employee Data column, in the Tables row, click the empty check box to select all of the
tables.

5.

In the No Employee Data column, clear the Employee and Sales Quota checkboxes, and then click
OK.

Task 3: Test a perspective


1.

On the Model menu, click Analyze in Excel. Then in the Analyze in Excel dialog box, ensure that
Current Windows User is selected, in the Perspective drop-down list, select (Default), and then
click OK.

2.

In Excel, in the PivotTable Field List pane, select Sum of SalesAmount. Then in the Employee table,
select EmailAddress. Note that the PivotTable shows sales by employee.

3.

Close Excel without saving any changes.

4.

In SQL Server Data Tools, on the Model menu, click Analyze in Excel. Then in the Analyze in Excel
dialog box, ensure that Current Windows User is selected, in the Perspective drop-down list, select
No Employee Data, and then click OK.

5.

In Excel, in the PivotTable Field List pane, select Sum of SalesAmount. However, note that the
Employee and Sales Quota tables are not available. Instead, in the Product Category table, select
Category to view sales by product category.

6.

Close Excel without saving any changes.

Lab Answer Key: Implementing an Analysis Services Tabular Data Model

Exercise 3: Implementing Partitions


Task 1: Create partitions
1.

In SQL Server Data Tools, on the Table menu, click Partitions.

2.

In the Partition Manager dialog box, in the Table list, select Reseller Sales.

3.

Click New, and then in the Partition Name field, type 2001.

4.

Click the Query Editor button.

5.

In the SQL Statement field, under the existing Transact-SQL statement, type the following WHERE
clause, and then click Validate, to verify that the syntax is valid:
WHERE DATEPART(YEAR, OrderDate)=2001

6.

Repeat steps 3 to 5 to create three more partitions by using the information in the following table:
Partition Name

SQL WHERE Clause

2002

WHERE DATEPART(YEAR, OrderDate)=2002

2003

WHERE DATEPART(YEAR, OrderDate)=2003

2004

WHERE DATEPART(YEAR, OrderDate)=2004

7.

When all of the partitions have been created, in the Partition Manager dialog box, click OK.

8.

Click the Reseller Sales tab, and on the Model menu, point to Process and click Process Partitions.

9.

In the Process Partitions dialog box, in the Process column, select 2001, 2002, 2003, and 2004, and
then click OK.

10. In the Data Processing dialog box, wait until the Status column displays Success for all of the
partitions, and then click Close.
11. On the Table menu, click Partitions.
12. In the Partition Manager dialog box, in the Table list, click Reseller Sales.
13. In the Partitions table, in the Last Processed column, note that the partitions that you created in
steps 1 to 6 have been processed. Look in the # Rows column, and note the number of rows that
each partition contains.
14. In the Partitions table, click the ResellerSales partition, and click Delete. Then click OK.

Task 2: View partitions in the workspace database


1.

Maximize SQL Server Management Studio, and in Object Explorer, in the workspace database for your
project, right-click the Reseller Sales table and then click Partitions.

2.

Review the # Rows and the Last Processed columns for each partition. Note that they match the
values that you saw in the Partition Manager dialog box in the Reseller Sales project in SQL Server
Data Tools.

3.

In the Partitions dialog box, click Cancel.

4.

Minimize SQL Server Management Studio.

Lab Answer Key: Implementing an Analysis Services Tabular Data Model

Exercise 4: Deploying an Analysis Services Tabular Data Model


Task 1: Deploy the Reseller Sales project
1.

In SQL Server Data Tools, in Solution Explorer, right-click Reseller Sales, and then click Properties.

2.

In the Reseller Sales Property Pages dialog box, in the Deployment Server area, in the Server field,
ensure that the server name is localhost\SQL2, and then click Cancel.

3.

In Solution Explorer, right-click Reseller Sales, and then click Deploy.

4.

In the Deploy dialog box, view the Status column. When the Status column displays Success for
every item in the Work Item column, click Close.

Task 2: View the deployed tabular database


1.

Maximize SQL Server Management Studio, and in Object Explorer, right-click the Databases node,
and then click Refresh. Note that the database has been deployed with the name Reseller Sales.

2.

Under the Databases, node, expand Reseller Sales, expand Connections, expand Tables, and then
review the items in the Connections and Tables folders.

3.

In Windows Explorer, browse to the C:\Program Files\Microsoft SQL Server\MSAS11.SQL2\OLAP


\Data folder, double-click the Reseller Sales.0.db folder. If prompted, click Continue.

4.

Review the items in the Reseller Sales.0.db folder. These are the physical files for the deployed
database.

5.

Close Windows Explorer.

Lab Answer Key: Implementing an Analysis Services Tabular Data Model

Exercise 5: Enabling Access to a Tabular Data Model


Task 1: Enable the BI Semantic Model Connection content type
1.

Start Internet Explorer and browse to the SharePoint site at http://mia-sqlbi. Then, on the Adventure
Works Portal Home page, in the Libraries list in the Quick Launch area on the left of the site, click
PowerPivot Gallery.

2.

On the ribbon, in the Library Tools section, click Library; and in the Settings area, click Library
Settings.

3.

Under the General Settings area, if a Content Types section exists, review the content types enabled
for this document library. If no Content Types section exists or the BI Semantic Model Connection
is not listed, perform the following steps to enable management of content types and add it.
1.

In General Settings, click Advanced settings.

2.

In Content Types, in the Allow management of content types? section, click Yes, and then
click OK.

3.

On the Document Library Settings page, in the Content Types section, click Add from
existing site content types.

4.

In the Select site content types from: list, click Business Intelligence.

5.

In the Available Site Content Types list, click BI Semantic Model Connection, click Add, and
then click OK.

Task 2: Create a BI semantic model connection


1.

In the Adventure Works Portal SharePoint site, in the Libraries list in the Quick Launch area, click
PowerPivot Gallery.

2.

On the ribbon, in the Library Tools section, click Documents; and then click the New Document
drop-down list and click BI Semantic Model Connection.

3.

On the New BI Semantic Model Connection page, in the File Name field, type Reseller Sales
Connection, in the Workbook URL or Server Name field, type localhost\SQL2, in the Database (if
connecting to a server) field, type Reseller Sales, and then click OK.

4.

Verify that the Reseller Sales Connection BI semantic model connection is added to the PowerPivot
Gallery.

Lab Answer Key: Implementing an Analysis Services Tabular Data Model

Task 3: Use a BI semantic model connection


1.

On PowerPivot Gallery page, click the Open New Excel Workbook icon for the Reseller Sales
Connection BI semantic model connection you created in the previous task.

2.

When prompted, click Open. Then, when the download has completed, click Open again.

1.

In Excel, in the Microsoft Excel Security Notice dialog box, click Enable.

2.

In the Select Table dialog box, ensure that Model is selected, and then click OK.

3.

In the PivotTable Field List pane, select Sum of SalesAmount. Then in the Sales Territory table,
select SalesTerritoryRegion. Note that the PivotTable shows sales by sales territory.

4.

Close Excel without saving any changes.

5.

Keep Internet Explorer open, you will use it in the next exercise.

Lab Answer Key: Implementing an Analysis Services Tabular Data Model

Exercise 6: Configuring DirectQuery Storage Mode


Task 1: Create a SQL Server Profiler trace
1.

Click Start, click All Programs, click Microsoft SQL Server 2012, click Performance Tools, and then
click SQL Server Profiler.

2.

On the File menu, click New Trace.

3.

In the Connect to Server dialog box, in the Server Type list, select Analysis Services, in the Server
Name dialog box, select localhost\SQL2, and then click Connect.

4.

In the Trace Properties dialog box, change the Trace name to BI Queries, and then click the
Events Selection tab.

5.

In the table of events, in the Events column, clear all events other than Query Begin and Query End.

6.

Select the Show all events check box.

7.

In the table of events, in the Events column, in the Query Processing section, select the Direct
Query Begin, Direct Query End, VertiPaq SE Query Begin, and VertiPaq SE Query End
checkboxes, and then click Run.

8.

Minimize SQL Server Profiler.

Task 2: Test InMemory storage mode


1.

In Internet Explorer, on PowerPivot Gallery page, click the Reseller Sales Connection BI semantic
model connection you created in the previous exercise. This creates a new Power View report.

2.

In the list of fields to the right, expand Reseller Sales and select Sales Amount. The total sales
amount is displayed in the report.

3.

Maximize SQL Server Profiler and view the trace. Note that the EventClass entries include Query
Begin, VertiPaq SE Query Begin, VertiPaq SE Query End, and Query End.

4.

Minimize SQL Server Profiler.

Task 3: Enable Direct Query storage mode


1.

Maximize SQL Server Management Studio and in Object Explorer, under Databases, right-click
Reseller Sales, and then click Properties.

2.

In the Database Properties Reseller Sales dialog box, on the Database page, in the General
section, in the DirectQueryMode list, click DirectQuery, and then click OK.

3.

Minimize SQL Server Management Studio. You will use it again in the next exercise.

Task 4: Test Direct Query storage mode


1.

Maximize Internet Explorer and in the list of fields, expand Product Category and click Category.
The report now shows sales by product category.

2.

Close Internet Explorer, clicking Leave this page when prompted.

3.

Maximize SQL Server Profiler and view the trace. Note that the EventClass entries now include Query
Begin, DirectQuery Begin, DirectQuery End, and Query End.

4.

On the File menu, click Stop Trace. Then close SQL Server Profiler.

10

Lab Answer Key: Implementing an Analysis Services Tabular Data Model

Exercise 7: Implementing Security in a Tabular Data Model


Task 1: Disable Direct Query storage mode
1.

Maximize SQL Server Management Studio and in Object Explorer, under Databases, right-click
Reseller Sales, and then click Properties.

2.

In the Database Properties Reseller Sales dialog box, on the Database page, in the General
section, in the DirectQueryMode list, click InMemory, and then click OK.

3.

Close SQL Server Management Studio.

Task 2: Create roles and apply database permissions


1.

In SQL Server Data Tools, on the Model menu, click Roles.

2.

In the Role Manager dialog box, click New.

3.

In the Name column, type Germany, click in the Permissions column, and then in the list box, click
Read.

4.

Repeat the previous two steps to create the following roles: Canada, France, United Kingdom,
United States, and Australia. Give all roles the Read database permission. Do not close the Role
Manager dialog box.

Task 3: Apply row-level permissions to roles


1.

In the Role Manager dialog box, click Germany.

2.

On the Row Filters tab, in the DAX Filter column, double-click the Sales Territory row, and type the
following DAX expression:
=[SalesTerritoryCountry]="Germany"

3.

Repeat steps 1 and 2 to apply row filters to the other roles by using the values in the following table:
Role Name

DAX Filter Expression

Canada

=[SalesTerritoryCountry]=Canada

France

=[SalesTerritoryCountry]=France

United Kingdom

=[SalesTerritoryCountry]=United Kingdom

United States

=[SalesTerritoryCountry]=United States

Australia

=[SalesTerritoryCountry]=Australia

4.

In the Role Manager dialog box, click OK.

5.

On the File menu, click Save All.

Lab Answer Key: Implementing an Analysis Services Tabular Data Model

11

Task 4: Test row-level permissions


1.

On the menu bar, click Model, and then click Analyze in Excel.

2.

In the Analyze in Excel dialog box, select Role, and in the drop-down list, select France and click OK.
Then in the Analyze in Excel dialog box click OK.

3.

In Excel, in the PivotTable Field List, under Reseller Sales, select Sum of SalesAmount.

4.

In the Sales Territory table, select SalesTerritoryCountry. Note that in the PivotTable, France is the
only country that is displayed.

5.

Close Excel without saving the workbook.

6.

Close SQL Server Data Tools.

Lab Answer Key: Creating Data Visualizations with Power View

Module 13
Lab Answer Key: Creating Data Visualizations with Power
View
Contents:
Exercise 1: Configuring a Tabular Data Model for Power View

Exercise 2: Creating a Simple Power View Report

Exercise 3: Using Interactive Visualizations

Exercise 4: Creating a Scatter Chart and a Play Axis

Exercise 5: Exporting a Power View Report to Excel

Lab Answer Key: Creating Data Visualizations with Power View

Lab 13: Creating Interactive Reports with


Power View
Exercise 1: Configuring a Tabular Data Model for Power View
Task 1: Prepare the Lab Environment
1.

Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to
MIA-SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab13, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab13\Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd) and click Run as administrator.

5.

Click Yes when prompted to confirm you want to run the command file, and wait for the script to
finish.

Task 2: Define reporting properties


1.

In the D:\10778A\Labfiles\Lab13\Starter folder, double-click Reseller and Internet Sales.sln.

2.

View the Model.bim model in the project, and on the Product Category tab, click the Product
Category column header. Then in the Properties window, in the Reporting Properties group, click
Default Label, and in the drop down list, click True.

3.

On the Reseller Sales tab, click the Order Quantity column. Then in the Properties window, in the
Reporting Properties group, click Summarize By, and in the drop down list, change the value to
Sum.

4.

On the Internet Sales tab, click the Order Quantity column. Then in the Properties window, in the
Reporting Properties group, click Summarize By, and in the drop down list, change the value to
Sum.

5.

On the Date tab, click the Month column. Then in the Properties window, in the Basic group, in the
Sort by Column drop-down list, select MonthNumberOfYear.

6.

On the tool bar, click the Save All button.

Task 3: Deploy the project


1.

In Solution Explorer, right click Reseller and Internet Sales and then click Deploy. If you are
prompted for impersonation credentials, specify the user name ADVENTUREWORKS\ServiceAcct
and the password Pa$$w0rd.

2.

In the Deploy dialog box, when deployment has completed successfully, click Close.

3.

Close SQL Server Data Tools.

Lab Answer Key: Creating Data Visualizations with Power View

Task 4: Create a BI semantic model connection


1.

Start Internet Explorer and browse to the SharePoint site at http://mia-sqlbi. Then, on the Adventure
Works Portal Home page, in the Libraries list in the Quick Launch area on the left of the site, click
PowerPivot Gallery.

2.

On the ribbon, in the Library Tools section, click Library; and in the Settings area, click Library
Settings.

3.

Under the General Settings area, if a Content Types section exists, review the content types enabled
for this document library. If no Content Types section exists or the BI Semantic Model Connection
is not listed, perform the following steps to enable management of content types and add it.
1.

In General Settings, click Advanced settings.

2.

In Content Types, in the Allow management of content types? section, click Yes, and then
click OK.

3.

On the Document Library Settings page, in the Content Types section, click Add from
existing site content types.

4.

In the Select site content types from: list, click Business Intelligence.

5.

In the Available Site Content Types list, click BI Semantic Model Connection, click Add, and
then click OK.

4.

In the Adventure Works Portal Home page at http://mia-sqlbi, in the Libraries list in the Quick
Launch area, click PowerPivot Gallery.

5.

On the ribbon, in the Library Tools section, click Documents; and then click the New Document
drop-down list and click BI Semantic Model Connection.

6.

On the New BI Semantic Model Connection page, in the File Name field, type Reseller and
Internet Sales, in the Workbook URL or Server Name field, type localhost\SQL2, in the Database
(if connecting to a server) field, type Reseller and Internet Sales, and then click OK.

7.

Verify that the Reseller and Internet Sales BI semantic model connection is added to the PowerPivot
Gallery.

Lab Answer Key: Creating Data Visualizations with Power View

Exercise 2: Creating a Simple Power View Report


Task 1: Create a Power View report
1.

On the PowerPivot Gallery page, to the right of Reseller and Internet Sales, click the Create
Power View Report button.

2.

In the Power View window, in the View area, click Click here to add title, and then type Internet
Sales by Calendar Year and Month.

3.

In the fields pane, expand Internet Sales, and then select Internet Sales Total.

4.

On the ribbon, on the Design tab, in the Visualizations area, click Column.

5.

Click and drag the lower right corner of the chart to resize it and fill the available space.

6.

In the fields pane, expand Date, and then select Calendar Year to add this column to the Axis field
in the Layout Section.

7.

Select Month to add this column to the Series field in the Layout Section.

8.

In the fields pane, expand Geography, and then select Country Region to add this column to the
Vertical Multiples field in the Layout Section.

Task 2: Add a Card visualization


1.

Drag the lower right corner of the chart to resize it to create some space to the right of the chart.
Then click in the blank space to the right of the column chart.

2.

In the fields pane, under Internet Sales, select Internet Sales Total.

3.

On the ribbon, on the Design tab, expand the Visualizations area, and in the Other category, click
Card.

4.

In the fields pane, expand Product Category, and select Product Category.

5.

Click and drag the corner of the Card to resize it as necessary.

Task 3: Add a filter


1.

Click in a blank area of the canvas, and then on the ribbon, on the Home tab, in the Filters area, click
Filters Area.

2.

In the fields pane, expand Product Category if necessary, drag Product Category to the filters tab,
and then select the Bikes and Clothing check boxes. The report is filtered to show data for only the
selected categories.

Lab Answer Key: Creating Data Visualizations with Power View

Exercise 3: Creating Interactive Visualizations


Task 1: Create a new view
1.

On the ribbon, in the Home tab, in the Views group, in the New View drop-down list, click New
View.

2.

In the View area, click Click here to add title, and then type Reseller Sales by Calendar Year and
Country.

3.

In the ribbon, on the Home tab, click Filters Area to hide the filters tab.

Task 2: Add tiles


1.

In the Field List, under Product Category, select Product Category, and then on the ribbon, in the
Visualizations group, click Tiles.

2.

Resize the visualization so that it fills the view area.

3.

Click the Product Category table under the blue line beneath the product category names, and then
in the fields pane, expand Reseller Sales, and select Reseller Sales Total.

4.

In the fields pane, in the Fields list, click the drop-down arrow for the Product Category field and
click Remove Field to remove it from the table.

5.

On the ribbon, on the Design tab, in the Visualizations area, click Bar. Then resize the bar chart area
so you can see the bar.

6.

In the fields pane, under Date, select Calendar Year to add this field to the Axis box in the Layout
Section.

7.

In the fields pane, expand Sales Territory, and select Country to add this field to the Series box in
the Layout Section.

8.

Resize the chart, leaving space below it and to the right of it for other visualizations.

9.

Click in the blank area to the right of the bar chart, and then in the fields pane, under Reseller Sales,
select Reseller Sales Total, Reseller Profit, and Order Quantity.

10. On the ribbon, on the Design tab, in the Visualizations area, click Card. Then resize the card area to
fill the available height to the right of the bar chart.
11. In the fields pane, under Product Category, click Product Category.
12. Click in the blank area under the bar chart, and then in the fields pane, in Reseller Sales, click
Reseller Sales Total.
13. On the ribbon, on the Design tab, in the Visualizations area, click Column.
14. In the fields pane, expand Employee, and select Last Name to add this field to the Axis box in the
Layout Section, and then under Date, select Calendar Year to add this field to the Series box.
15. Resize the visualizations as required.
16. In the navigation strip, click each of the category names and note that the charts update
automatically to show sales data for the selected category.

Lab Answer Key: Creating Data Visualizations with Power View

Exercise 4: Creating a Scatter Chart and a Play Axis


Task 1: Create a new view
1.

On the ribbon, in the Home tab, in the Views group, in the New View drop-down list, click New
View.

2.

Click Click here to add title, and then type Reseller Profit Over Time.

Task 2: Create a scatter chart


1.

In the fields pane, under Reseller Sales, click Reseller Sales Total.

2.

On the ribbon, on the Design tab, in the Visualizations area, click Scatter.

3.

Click and drag the corner of the chart to resize it to fill the available space.

4.

In the fields pane, under Reseller Sales, click Total Product Cost to add this field to the Y Value box.

5.

In the fields pane, under Reseller Sales, click Reseller Profit to add this field to the Size box.

6.

In the fields pane, expand Product Subcategory, and select Product Subcategory to add this field
to the Details box .

7.

In the fields pane, under Date, click and drag Calendar Year to the Play Axis box.

8.

If the filters pane is not visible, on the ribbon, on the Home tab, click Filters Area.

9.

In the fields pane, under Product Category, drag Product Category to the filters pane, and then
select the Bikes check box.

10. On the ribbon, in the Chart Tools area, click the Layout tab. Then in the Labels area, click Data
Labels, and then click Right.
11. In the chart, on the Calendar Year play axis, click the play button.
12. Note that for Mountain Bikes and Road Bikes, Reseller Sales Total and Total Product Cost both
increase over time, before the Total Product Cost for Road Bikes starts to fall in 2003. When
Touring Bikes were first introduced, the Total Product Cost was high relative to the ResellerSales
Total value, but the Reseller Sales Total value rapidly increased over time, while the Total Product
Cost remained quite static over the same period.

Lab Answer Key: Creating Data Visualizations with Power View

Exercise 5: Exporting a Power View Report to Excel


Task 1: Save the report
1.

On the ribbon, click File, and then click Save.

2.

In the Save As dialog box, change the File name to Sales Report and click Save.

3.

On the ribbon, click File, and then click Export to PowerPoint. When a message box informs you
that the export is complete, click Save, and save the presentation as Sales Report.pptx in the
D:\10778A\Labfiles\Lab13\Starter folder.

4.

Close Internet Explorer.

Task 2: View the presentation


1.

In the D:\10778A\Labfiles\Lab13\Starter folder, double-click Sales Report.pptx to open it in


Microsoft PowerPoint.

2.

In the ribbon, on the Slide Show tab, click From Beginning. If a message warns you about a graphics
card issue, click OK.

3.

View the first slide, and then move the mouse to the bottom left of the slide and click the Next
button.

4.

On the Reseller Sales by Calendar Year and Country slide, click the click to interact button at the
bottom right.

5.

When the slide is redrawn, in the list of categories along the top of the main report area, click Bikes
and note that the data visualizations are updated to show sales for bikes.

6.

Click outside of the border around the visualizations area to move to the next slide.

7.

On the Reseller Profit Over Time slide, click the click to interact button at the bottom right.

8.

When the slide is redrawn, click the Play button for the Calendar Year axis.

9.

Press Esc to stop the slide show, and then close PowerPoint without saving any changes.

Lab Answer Key: Performing Predictive Analysis with Data Mining

Module 14
Lab Answer Key: Performing Predictive Analysis with Data
Mining
Contents:
Exercise 1: Using Table Analysis Tools

Exercise 2: Creating a Data Mining Model

Exercise 3: Using the Data Mining Add-in for Excel to Modify


the Data Mining Structure

Exercise 4: Validating Data Mining Models

Exercise: Using a Data Mining Model in a Report

Lab Answer Key: Performing Predictive Analysis with Data Mining

Lab 14: Using Data Mining to Support a


Marketing Campaign
Exercise 1: Using Table Analysis Tools
Task 1: Prepare the lab environment
1.

Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to
MIA-SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

2.

Click Start, and then click Computer.

3.

Double-click Local Disk (D:), double-click 10778A, double-click Labfiles, double-click Lab14, and
then double-click Starter to view the contents of the D:\10778A\Labfiles\Lab14\Starter folder.

4.

Right-click the Setup Windows Command Script file (Setup.cmd) and click Run as administrator.

5.

Click Yes when prompted to confirm you want to run the command file, and wait for the script to
finish.

Task 2: Use the Data Mining Add-in for Excel to create a connection to
Analysis Services
1.

In the D:\10778A\Labfiles\Lab14\Starter folder, double click Customer Data For Data Mining.xlsx to
open it in Microsoft Excel.

2.

On the ribbon, in the Table Tools group, click the Analyze tab, in the Connection group, click the
connection icon (which is labeled with the name of the last connection used or <No Connection>).
Then in the Analysis Services Connections dialog box, click New.

3.

In the Connect to Analysis Services dialog box, in the Server name field, type localhost, in the
Catalog name drop-down list, click DMAddinsDB, and then click OK.

4.

In the Analysis Services Connections dialog box, click Close.

Task 3: Use the Data Mining Add-in for Excel table analysis tools
1.

On the ribbon, click Analyze Key Influencers.

2.

In the SQL Server Data Mining - Analyze Key Influencers dialog box, in the Column Selection
drop-down list, click Purchased Bike, and then click Run.

3.

In the SQL Server Data Mining Discrimination based on key influencers dialog box, in the
Compare Value 1 drop-down list, click Yes, and then in the to Value 2 drop-down list, click No.

4.

Click Add Report, and then click Close.

5.

Review the Key Influencers Report for Purchased Bike report. And note the values that most
strongly correlate with a customer purchasing a bike.

6.

Click File, click Exit, and then in the Microsoft Excel dialog box, click Save.

Lab Answer Key: Performing Predictive Analysis with Data Mining

Exercise 2: Creating a Data Mining Model


Task 1: Create a data mining project
1.

Click Start, click All Programs, click Microsoft SQL Server 2012, and then click SQL Server Data
Tools.

2.

In SQL Server Data Tools, click File, click New, click Project.

3.

In the New Project dialog box, click Analysis Services Multidimensional and Data Mining Project,
in the Name field, type, AW Data Mining, in the Location field, browse to the
D:\10778A\Labfiles\Lab14\Starter folder, click Select Folder, and then click OK.

4.

In Solution Explorer, right-click Data Sources, and then click New Data Source.

5.

In the Data Source Wizard, on the Welcome to the Data Source Wizard page, click Next, and then
on the Select how to define the connection page, click New.

6.

In the Connection Manager dialog box, in the Server name field, type localhost, in the Select or
enter a database name drop-down list, click AdventureWorksDW, and then click OK.

7.

In the Data Source Wizard, on the Select how to define the connection page, click Next, on the
Impersonation Information page, click Use a specific Windows user name and password, in the
User name field, type ADVENTUREWORKS\Student, in the Password field, type Pa$$w0rd, and
then click Next.

8.

On the Completing the Wizard page, click Finish.

9.

In Solution Explorer, right-click Data Source Views, and then click New Data Source View.

10. In the Data Source View Wizard, on the Welcome to the Data Source View Wizard page, click
Next, on the Select a Data Source page, ensure that Adventure Works DW is selected, and then
click Next.
11. On the Select Tables and Views page, in the Available objects list, click ProspectiveBuyer (dbo),
hold the Ctrl key, click, vTargetMail (dbo) and, click the > button to move the selected objects to
the Included objects list, and then click Next.
12. On the Completing the Wizard page, in the Name field, type Adventure Works DW DM View,
and then click Finish.

Task 2: Create a data mining structure and a data mining model


1.

In Solution Explorer, right-click Mining Structures, click New Mining Structure, and then in the
Data Mining Wizard, on the Welcome to the Data Mining Wizard page, click Next.

2.

On the Select the Definition Method page, ensure that From existing relational database or data
warehouse is selected, and then click Next.

3.

On the Create the Data Mining Structure page, ensure that Create mining structure with mining
model is selected, in the Which data mining technique do you want to use? drop-down list, click
Microsoft Decision Trees, and then click Next.

4.

On the Select a Data Source View page, click Next.

5.

On the Specify Table Types page, in the vTargetMail row, select the check box in the Case column,
and then click Next.

Lab Answer Key: Performing Predictive Analysis with Data Mining

6.

On the Specify the Training Data page, in the Mining model structure table, in the BikeBuyer
row, select the check box in the Predictable column, in the CustomerKey row, select the check box
in the Key column, in the Input column select all of the rows except CustomerKey and BikeBuyer,
and then click Next.

7.

On the Specify Columns Content and Data Type page, click Detect. Ensure that the content type
of the Bike Buyer column is identified as Discrete, and change the Yearly Income column to be
Discrete. Then click Next.

8.

On the Create Testing Set page, note that the Percentage of data for testing value is 30%, and
then click Next.

9.

On the Completing the Wizard page, in the Mining structure name field, type Purchase
Prediction in the Mining model name field, type Purchase Decision Tree and then click Finish.

Task 3: Deploy the data mining model


1.

On the menu bar, click Build, and then click Deploy AW Data Mining.

Lab Answer Key: Performing Predictive Analysis with Data Mining

Exercise 3: Using the Data Mining Add-in for Excel to Modify the Data
Mining Structure
Task 1: Connect to the AW Data Mining model
1.

Click Start, click All Programs, click Microsoft Office, and then click Microsoft Excel 2010.

2.

On the ribbon, click the Data Mining tab, in the Connection area, click the connection icon (which is
labeled with the name of the last connection used or <No Connection>), and then in the Analysis
Services Connections dialog box, click New.

3.

In the Connect to Analysis Services dialog box, in the Server name field, type localhost, in the
Catalog name drop-down list, click AW Data Mining, and then click OK.

4.

In the Analysis Services Connections dialog box, click Close.

Task 2: Add a model to the data mining structure


1.

On the ribbon, in the Data Modeling area, click Advanced, and then click Add Model to Structure.

2.

In the Add Model to Structure Wizard, on the Getting Started with the Add Model to Structure
Wizard page, click Next, on the Select Structure or Model page, ensure that the Purchase
Prediction structure is selected, and then click Next.

3.

On the Select Mining Algorithm page, in the Algorithm drop-down list, click Microsoft Naive
Bayes, and then click Next.

4.

On the Select Columns page, in the Bike Buyer row, in the Usage column, click Predict Only, in the
Name Style row, in the Usage column, click Do not use, and then click Next.

5.

On the Finish page, click Finish.

Task 3: Review the data mining model


1.

In the Browse dialog box, on the Dependency Network tab, review the diagram that shows the
factors that correlate with Bike Buyer, and then under All Links, click once to remove the weakest
correlates from the diagram.

2.

Repeat step 1 until the diagram shows only the strongest correlations.

3.

Click the Attribute Profiles tab, and review the attribute profile graphics.

4.

Click the Attribute Characteristics tab, in the Value drop-down list click 1, and then review the
information in the Characteristics for 1 table.

5.

Click the Attribute Discrimination tab, in the Value 1 drop-down list, click 1, in the Value 2 dropdown list, click 0, and then review the information in the Discrimination scores for 1 and 0 table.
Maximize the window if necessary.

6.

In the Browse dialog box, click Close.

Lab Answer Key: Performing Predictive Analysis with Data Mining

Exercise 4: Validating Data Mining Models


Task 1: Use the Accuracy Chart wizard
1.

On the ribbon, in the Accuracy and Validation area, click Accuracy Chart.

2.

In the Accuracy Chart Wizard, on the Getting Started with the Accuracy Chart Wizard page, click
Next.

3.

On the Select Structure or Model page, click Next.

4.

On the Specify Column to Predict and Value to Predict page, in the Mining column to predict
drop-down list, ensure that Bike Buyer is selected, in the Value to predict drop-down list, click 1,
and then click Next.

5.

On the Select Source Data page, ensure that Test data from mining structure is selected, and then
click Finish.

6.

In the Accuracy Chart for Structure Purchase Prediction chart, review the data for Purchase
Bayes, Purchase Decision Tree, Ideal Model, and No Model.

Task 2: Use the Classification Matrix Wizard


1.

On the ribbon, in the Accuracy and Validation area, click Classification Matrix.

2.

In the Classification Matrix Wizard, on the Getting Started with the Classification Matrix Wizard
page, click Next.

3.

On the Select Structure or Model page, click Next.

4.

On the Specify Column to Predict page, click Next.

5.

On the Select Source Data page, ensure that Test data from mining structure is selected, and then
click Finish.

6.

In the Counts of correct/incorrect classification for structure Purchase Prediction chart, review
the data for Purchase Bayes and Purchase Decision Tree.

Task 3: Use the Profit Chart Wizard


1.

On the ribbon, in the Accuracy and Validation area, click Profit Chart.

2.

In the Profit Chart Wizard, on the Getting Started with the Profit Chart Wizard page, click Next.

3.

On the Select Structure or Model page, click Next.

4.

On the Specify Profit Chart Parameters page, in the Value to predict drop-down list, click 1, in the
Target Population field, type 5000 in the Fixed cost field, type 500.00 in the Individual cost field,
type 1.00 in the Revenue per individual field, type 150.00 and then click Next.

5.

On the Select Source Data page, ensure that Test data from mining structure is selected, and then
click Finish.

6.

In the Profit Chart for Structure Purchase Prediction chart, review the data for Purchase Bayes
and Purchase Decision Tree.

7.

Click File, click Save, in the Save As dialog box, navigate to D:\10778A\Labfiles\Lab14\Starter, in the
File name field, type DM Validation.xlsx, and then click Save.

Lab Answer Key: Performing Predictive Analysis with Data Mining

Exercise 5: Using a Data Mining Model in a Report


Task 1: Create a report
1.

On the taskbar, click AW Data Mining Microsoft Visual Studio, on the menu bar, click File, and
then click Close Project.

2.

Click File, click New, click Project, in the Installed Templates pane, click Business Intelligence, click
Report Server Project Wizard, in the Name field, type Promotion Targeting, and then click OK.

3.

In the Report Wizard, on the Welcome to the Report Wizard page, click Next.

4.

On the Select the Data Source page, under New data source, in the Type drop-down list, select
Microsoft SQL Server Analysis Services.

5.

Click Edit, in the Connection Properties dialog box, in the Server name field, type localhost, in the
Connect to a database area, in the Select or enter a database name drop-down list, click AW Data
Mining, and then click OK.

6.

On the Select the Data Source page, click Next.

7.

On the Design the Query page, click Query Builder.

8.

In Query Designer, in the Mining Model pane, click Select Model, in the Select Mining Model
dialog box, expand Purchase Prediction, click Purchase - Bayes, and then click OK.

9.

In the Select Input Table(s) pane, click Select Case Table, in the Select Table dialog box, click
ProspectiveBuyer (dbo), and then click OK.

10. Under the Mining Model pane, in the Source column, in the drop-down list, click ProspectiveBuyer
table, and then in the Field column, in the drop-down list, click FirstName.
11. Repeat step 10 to add five more rows to the table by using the settings in the following table, and
then click OK.
Source

Field

Alias

Criteria/Argument

ProspectiveBuyer
table

LastName

N/A

N/A

ProspectiveBuyer
table

Address Line 1

N/A

N/A

ProspectiveBuyer
table

City

N/A

N/A

Purchase Bayes
mining model

Bike Buyer

N/A

=1

Prediction Function

PredictProbability

Purchase Probability

[Purchase - Bayes].[Bike
Buyer]

12. On the Design the Query page, click Next, on the Select the Report Type page, select Tabular,
click Next, on the Design the Table page, click Next, on the Choose the Table Style page, click
Next, on the Choose the Deployment Location page, click Next, on the Completing the Wizard
page, in the Report name field, type Potential Bike Buyers, and then click Finish.

Lab Answer Key: Performing Predictive Analysis with Data Mining

13. On the design surface, on the Design tab, in the Potential Bike Buyers report, in the First Name
column, click [First Name], to the left of [First Name], right-click the button, and then click Tablix
Properties.
14. In the Tablix Properties dialog box, click Sorting, in the Change sorting options pane, click Add, in
the Sort by drop-down list, click [Purchase_Probability], in the Order drop-down list, click Z to A,
and then click OK.
15. In the Purchase Probability column, right-click [Purchase Probability], click Text Box Properties,
in the Text Box Properties dialog box, click Number, in the Set number and data formatting
options pane, click Percentage, and then click OK.
16. Click the Preview tab to review the Potential Bike Buyers report.

Vous aimerez peut-être aussi