You are on page 1of 152

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
Implementing Data Models and Reports
with Microsoft® SQL Server® 2012
Companion Content
2 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.
© 2011 Microsoft Corporation. All rights reserved.

Microsoft, and Windows are either registered trademarks or trademarks of Microsoft Corporation in the
United States and/or other countries.
All other trademarks are property of their respective owners.

Product Number: 10778A

Released: 05/2012
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 3
4 Implementing Data Models and Reports with Microsoft® SQL Server® 2012
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 5
6 Implementing Data Models and Reports with Microsoft® SQL Server® 2012
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 7

Module 1
Introduction to Business Intelligence and Data Modeling
Contents:
Lesson 1: Introduction to Business Intelligence 8

Lesson 2: The Microsoft Business Intelligence Platform 10

Module Reviews and Takeaways 12


8 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 1
Introduction to Business Intelligence
Contents:
Additional Reading 9
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 9

Additional Reading
Business Intelligence Scenarios
• For more information about building and populating data warehouses, you should attend Course
10777A, Implementing a Data Warehouse with Microsoft® SQL Server® 2012.
10 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 2
The Microsoft Business Intelligence Platform
Contents:
Additional Reading 11
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 11

Additional Reading
Microsoft Business Intelligence Technologies
• For more information about multidimensional databases in SQL Server 2012 Analysis Services, see
Module 5 of this course, Creating Multidimensional Databases. For more information about tabular
databases in SQL Server 2012 Analysis Services, see Module 12 of this course, Implementing an
Analysis Services Tabular Data Model. For more information about PowerPivot technologies, see
Module 10 of this course, Implementing a Tabular Data Model with Microsoft PowerPivot.

• For more information about Reporting Services in SQL Server 2012, see Module 2 of this course,
Implementing Reports with SQL Server Reporting Services. For more information about Power View,
see Module 13 of this course, Creating Data Visualizations with Power View.

• For more information about SQL Server Integration Services, Data Quality Services, and Master Data
Services, you should attend Course 10777A, Implementing a Data Warehouse with Microsoft® SQL
Server® 2012.

• For more information about PowerPivot for Excel and PowerPivot for SharePoint, see Module 10 of
this course, Implementing a Tabular Data Model with Microsoft PowerPivot.
• For more information about data mining and the Data Mining Add-ins for Excel and Data Mining in
SQL Server 2012 Analysis Services, see Module 14 of this course, Performing Predictive Analysis with
Data Mining.

BI Semantic Models in SQL Server 2012 Analysis Services


• For more information about tabular data models in SQL Server 2012 Analysis Services, see Module 12
of this course, Implementing an Analysis Services Tabular Data Model. For more information about
multidimensional data models in SQL Server 2012 Analysis Services, see Module 5 of this course,
Creating Multidimensional Databases.

Considerations for SharePoint Configuration


• Deployment Checklist: Install Reporting Services into an Existing SharePoint Farm.
• Install PowerPivot for SharePoint

• Deployment Checklist: Reporting Services, Power View, and PowerPivot for SharePoint

• Microsoft SQL Server PowerPivot Planning and Deployment


12 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Module Reviews and Takeaways


Review questions
Question: How do the BI implementations in your place of work use Microsoft technologies?

Answer: Answers will vary depending upon individuals and their experiences.

Question: Does your organization use SharePoint in a BI context?

Answer: Answers will vary depending upon individuals and their experiences.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 13

Module 2
Implementing Reports with SQL Server Reporting Services
Contents:
Lesson 1: Introduction to Reporting Services 14

Lesson 2: Creating a Report with Report Designer 16

Lesson 3: Grouping and Aggregating Data in a Report 19

Lesson 4: Showing Data Graphically 23

Lesson 5: Filtering Reports By Using Parameters 26

Lesson 6: Publishing and Viewing a Report 29

Module Reviews and Takeaways 31


14 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 1
Introduction to Reporting Services
Contents:
Additional Reading 15
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 15

Additional Reading
SQL Azure Reporting Services
• Windows Azure Business Analytics
16 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 2
Creating a Report with Report Designer
Contents:
Detailed Demonstration Steps 17
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 17

Detailed Demonstration Steps


Demonstration: Creating a Report
Detailed demonstration steps
X Task 1: Use the Report Wizard to create a report
1. Ensure that both MIA-DC1 and MIA-SQLBI virtual machines are running, and then log on to MIA-
SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd. Then, in the
D:\10778A\Demofiles\Mod02 folder, run Setup.cmd as Administrator.

2. Start SQL Server Data Tools, and create a new project using the Report Server Project Wizard
template. Name the project ReportsDemo1 and save in the D:\107778A\Demofiles\Mod02 folder.

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

4. In the Select the Data Source page, create a new data source named AdventureWorksDW that
uses Windows authentication to connect to the AdventureWorksDW database on the localhost
instance of SQL Server. Do not select the Make this a shared data source checkbox, and click Next.

5. On the Design the Query page, click Query Builder, and in the Query Designer window, perform
the following steps and click OK. Then click Next.

• Add the DimGeography, DimReseller, and FactResellerSales tables.

• Select the EnglishCountryRegionName, StateProvinceName, and City columns in the


DimGeography table.

• Select the ResellerName column in the DimReseller table.

• Select the SalesOrderNumber, OrderDate, and SalesAmount columns in the FactResellerSales


table.
• Add the following values to the Alias column:

EnglishCountryRegionName: Country

StateProvincename: State
ResellerName: Reseller

6. On the Select the Report Type page, ensure that Tabular is selected, and then click Next.

7. On the Design the Table page, add all fields to the Details section. Then click Next.
8. On the Choose the Table Style page, preview each of the built-in styles, and then select Generic and
click Next.

9. On the Choose the Deployment Location page, review the default selections and then click Next.

10. On the Completing the Wizard page, change the report name to Reseller Sales and click Finish.

X Task 2: Format and preview a report in Report Designer


1. When the report has been created, click the report design surface and in the View menu, click
Report Data.
18 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

2. In the Report Data pane, expand Data Sources and note that the AdventureWorksDW data source
you defined in the wizard has been created. Then expand Datasets and note that a dataset named
Dataset1 has been created from the query you defined in the wizard.

3. Right-click Dataset1 and click Dataset Properties. Then change the name to ResellerSales and click
OK.

4. Click the Preview tab and view the report with its default formatting. Then click the Design tab.

5. In the report body, click the text box at the top left containing the report title (Reseller Sales), and
then use the formatting buttons on the toolbar to make the title bold with a size of 14pt.

6. Click the tablix data region so that the gray row and column headers appear, and click the gray box
where the row and column headers intersect to select the data region. Then drag the multidirectional
arrow handle to move the data region down to make room for a larger title.

7. Click the title textbox and resize it so all of the text is visible.

8. In the tablix data region, click the top-left cell (which contains the Country column title) and drag to
the bottom-right cell (which contains the [SalesAmount] field) to select all cells in the data region.
Then click the Align Left button on the toolbar.

9. Click outside of the tablix data region to de-select it, and then select the first row of the tablix data
region (which contains the column titles) and on the toolbar, click the Bold button. Then click the
Background Color button and set the background to Light Gray.

10. Right-click the cell containing the [OrderDate] field and click Textbox Properties. Then in the Text
Box Properties dialog box, on the Number tab, select the Date category and the 31-Jan-00 type
and click OK.

11. Click the cell containing the [SalesAmount] field and press F4. Then in the Properties pane, set the
Format property to $###,##0.00.
12. Click the tablix region so that the gray row and column headers appear, and then click and drag the
border between the column headings to widen the columns so that the data they contain fits on a
single line. You may need to switch back and forth between Design and Preview tabs to determine
appropriate column widths.

13. Click the Preview tab to view the completed report.

14. Click the Export button, and then click Excel. When prompted, save the report as Reseller Sales.xlsx in
the D:\107778A\Demofles\Mod02 folder.

15. Close SQL Server Data Tools, and then open the Reseller Sales.xlsx Excel workbook in the
D:\107778A\Demofles\Mod02 folder and view the exported report.
16. Close Excel.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 19

Lesson 3
Grouping and Aggregating Data in a Report
Contents:
Detailed Demonstration Steps 20
20 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Grouping Data in a Report
Detailed demonstration steps
X Task 1: Create groups in a Tablix data region
1. Ensure that both MIA-DC1 and MIA-SQLBI virtual machines are running, and then log on to MIA-
SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd. Then, in the
D:\10778A\Demofiles\Mod02 folder, run Setup.cmd as Administrator.

2. Double-click ReportsDemo2.sln in the D:\107778A\Demofiles\Mod02 folder to open the solution in


SQL Server Data Tools. Then in Solution Explorer, double-click the Reseller Sales.rdl report.

3. In the Groupings pane, in the Row Groups section, in the table1_Details_Group drop-down list, point
to Add Group and click Parent Group. Then in the Tablix Group dialog box, in the Group By list
click [Country], select Add group header, and click OK.
4. Note that the report now contains two Country columns – one for the group you just created, and
one for the original Country field, which is no longer required. Right-click the gray column header for
the original Country field (the second column) and click Delete Columns to remove it.

5. In the Report Data pane, expand Datasets, and drag the State field from the ResellerSales dataset
and drop it between the Country and table1_Details_Group groups in the Grouping pane. Note that
this adds a group for the State field without a group header in addition to the original State field.
Then, right-click the gray column header for the original State field (the third column) and click
Delete Columns to remove it.

6. Right-click the [State] field in the second column, point to Insert Row, and click Inside Group –
Above. This creates a header row for the group.

7. Right-click the [City] field in the third column, point to Add Group, and under Row Group, click
Parent Group. Then in the Tablix Group dialog box, in the Group By list click [City], select Add
group header, and click OK. Then, right-click the gray column header for the original City field (now
the fourth column) and click Delete Columns to remove it.

8. Right-click the [City] field in the third column, point to Add Group, and click Child Group. Then in
the Tablix Group dialog box, in the Group By list click [Reseller], select Add group header, and
click OK. Then, right-click the gray column header for the original Reseller field (the fifth column)
and click Delete Columns to remove it.
9. In the Groupings pane, in the table1_Details_Group drop-down list, click Group Properties. Then
on the Sorting tab, click Add and in the Sort by column, click [OrderDate]. Then click OK.

10. Preview the report, and switch back to the Design tab to widen the new columns as required. When
you are satisfied with the column widths, preview the report and note that the data is now grouped
and sorted.

X Task 2: Display aggregate values for data groups


1. On the Design tab, in the Groupings pane, on the Country drop-down list, point to Add Total and
click After. Note that this adds a row at the bottom of the table with an expression to calculate the
sum of the [SalesAmount] field.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 21

2. In the Groupings pane, on the State drop-down list, point to Add Total and click Before. Note that
this adds an expression to calculate the sum of the [SalesAmount] field to the first row in the table
(in which the [Country] field is displayed in the first column).

3. Repeat the previous step for the City, Reseller, and table1_Details_Group groups, and note that the
Sales Amount column now contains subtotals for each grouping with a grand total at the bottom.

4. When you added the totals, Report Designer automatically created a Total label for each row. Delete
all of these Total labels other than the one on the bottom row of the table.

5. Right-click the cell immediately above the [Sales Order Number] field in the Sales Order Number
column, and click Expression. Then in the Expression dialog box, enter the following expression and
click OK.

=CountDistinct(Fields!SalesOrderNumber.Value)

6. Right-click the cell containing the expression you just created and click Copy, and then paste the cell
into each of the empty cells above it.

7. Preview the report, and note that the number of orders and sales total for each group is displayed.

X Task 3: Enable drilldown interactivity


1. On the Design tab, in the Groupings pane, in the table1_Details_Group drop-down list, click Group
Properties.

2. In the Group Properties dialog box, on the Visibility tab, select the Hide option, select the Display
can be toggled by this report item checkbox, and in the drop-down list, select Reseller1. Then click
OK. Reseller1 is the textbox containing the name of the reseller for each Reseller group.

3. Repeat the previous two steps to hide the following groups and enable them to be toggled by the
specified report items:

• Reseller (toggled by City1)

• City (toggled by State1)

• State (toggled by Country1)


4. Preview the report and note that you can expand and contract the groupings to display the level of
detail you require.

X Task 4: Configure report pagination based on data groups


1. On the Design tab, click the report design surface and press F4. Then in the Properties pane, set the
InitialPageName property for the Report item to Reseller Sales Report.

2. Click the tablix data region so that the gray row and column headers appear, and click the gray box
where the row and column headers intersect to select the data region. Then in the Properties pane,
expand the PageBreak property group for the table1 tablix and set the BreakLocation property to
Start. This creates a page break at the start of the tablix data region.

3. In the Groupings pane, click the Country group. Then in the Properties pane, expand the Group and
PageBreak property groups for the Country tablix member and set the BreakLocation property to
Between. This creates a page break between each instance of the Country group.

4. With the Country group still selected, in the Properties pane, set the PageName property to the
following expression:
22 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

=Fields!Country.Value

5. Preview the report and note that the first page contains only the report title.

6. Use the page navigation buttons to scroll through the report and verify that each country group
starts on a new page.

7. Click the Export button, and then click Excel. When prompted, save the report as Reseller Sales.xlsx in
the D:\107778A\Demofles\Mod02 folder – replacing the file if it already exists.

8. Close SQL Server Data Tools, and then open the Reseller Sales.xlsx Excel workbook in the
D:\107778A\Demofles\Mod02 folder and view the exported report, noting that it contains a title
worksheet and a worksheet for each country, in which users can expand or collapse the grouped data.
Then close Excel.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 23

Lesson 4
Showing Data Graphically
Contents:
Detailed Demonstration Steps 24

Additional Reading 25
24 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Creating a Chart
Detailed demonstration steps
X Task 1: Add a chart to a report
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. Then, in the
D:\10778A\Demofiles\Mod02 folder, run Setup.cmd as Administrator.

2. Double-click ReportsDemo3.sln in the D:\107778A\Demofiles\Mod02 folder to open the solution in


SQL Server Data Tools. Then in Solution Explorer, double-click the Reseller Sales.rdl report.

3. Click the tablix data region so that the gray row and column headers appear, and click the gray box
where the row and column headers intersect to select the data region. Then drag the multidirectional
arrow handle to move the data region down about 10 centimeters.
4. In the Toolbox, drag a Chart to the blank area you just created above the tablix data region. Then in
the Select Chart Type dialog box, in the Shape section select the third chart style (3-D Pie) and click
OK.

5. Move and resize the chart to fit the available space above the tablix data region.

X Task 2: Specify chart data


1. Click the chart to display the Chart Data pane.

2. In the Chart Data pane, in the Values section, add the SalesAmount field.
3. In the Chart Data pane, in the Category Groups section, add the Country field.

4. Click the Preview tab and verify that the chart displays sales by country.

X Task 3: Format a chart


1. On the Design tab, click the Chart Title label, and then in the Properties pane change the Caption
property to Reseller Sales by Country.

2. Click a blank area on the report design surface, and then right-click the chart, point to Chart, and click
Chart Properties.

3. In the Chart Properties dialog box, in the Color palette drop-down list, select Bright pastel, and
click OK.

4. Preview the report and view the formatted chart.

5. Click the Export button, and then click Excel. When prompted, save the report as Reseller Sales.xlsx in
the D:\107778A\Demofles\Mod02 folder – replacing the file if it already exists.

6. Close SQL Server Data Tools, and then open the Reseller Sales.xlsx Excel workbook in the
D:\107778A\Demofles\Mod02 folder and view the exported report, noting that the first worksheet
contains the chart. Then close Excel.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 25

Additional Reading
Working with Charts
• For more information about using charts in reports, see Charts (Report Builder 3.0 and SSRS) in SQL
Server Books Online.

Showing Key Values with Gauges


• For more information about using gauges in reports, see Gauges (Report Builder 3.0 and SSRS) in SQL
Server books Online.

Summarizing Data with Data Bars and Sparklines


• For more information about using data bars and sparklines in reports, see Sparklines and Data Bars
(Report Builder 3.0 and SSRS) in SQL Server books Online.

Using Indicators
• For more information about using indicators in reports, see Indicators (Report Builder 3.0 and SSRS) in
SQL Server books Online.

Displaying Geographical Data with Maps


• For more information about using maps in reports, see Maps (Report Builder 3.0 and SSRS) in SQL
Server books Online.
26 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 5
Filtering Reports By Using Parameters
Contents:
Detailed Demonstration Steps 27
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 27

Detailed Demonstration Steps


Demonstration: Using a Parameter
Detailed demonstration steps
X Task 1: Add a parameter to a report
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. Then, in the
D:\10778A\Demofiles\Mod02 folder, run Setup.cmd as Administrator.

2. Double-click ReportsDemo4.sln in the D:\107778A\Demofiles\Mod02 folder to open the solution in


SQL Server Data Tools. Then in Solution Explorer, double-click the Reseller Sales.rdl report.

3. In the Report Data pane, expand Datasets and then right-click the ResellerSales dataset and click
Query.

4. In the Query Designer dialog box, add the following WHERE clause to the existing Transact-SQL
query, and then click OK.

WHERE YEAR(FactResellerSales.OrderDate) = @Year

5. Right-click the ResellerSales dataset and click Dataset Properties. Then in the Dataset Properties
dialog box, on the Parameters tab, note that a dataset property named @Year has been created,
and click OK.

6. In the Report Data pane, expand Parameters and note that a report parameter named Year has been
created.

X Task 2: Configure a parameter


1. In the Report Data pane, right-click the Year report parameter and click Parameter Properties.

2. In the Report Parameter Properties dialog box, on the General tab, in the data type drop-down list,
select Integer. Then click OK.
3. Click the Preview tab and note that the report is not rendered. Then, in the Year text box, type 2004
and click View Report. The report is then rendered with data for sales in 2004.

X Task 3: Set available and default values for a parameter


1. On the Design tab, in the Report Data pane, right-click Datasets and click Add Dataset.

2. In the Dataset Properties dialog box, perform he follow steps and then click OK.

• In the Name box type SalesYears.

• Select Use a dataset embedded in my report.

• In the Data Source drop-down list, select AdventureWorksDW.

• Ensure that the Text query type option is selected.

• Enter the following Transact-SQL query.

SELECT DISTINCT YEAR(OrderDate) Year


FROM FactResellerSales
ORDER BY YEAR(OrderDate)
28 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

3. Repeat the previous two steps to create a dataset named MostRecentSalesYear that uses the
following Transact-SQL query.

SELECT MAX(YEAR(OrderDate)) MaxYear


FROM FactResellerSales

4. In the Report Data pane, right-click the Year report parameter and click Parameter Properties.

5. In the Report Parameter Properties dialog box, on the Available Values tab, perform the following
steps:

• Select Get values from a query.

• In the Dataset drop-down list, select SalesYears.


• In the Value field drop-down list, select Year.

• In the Label field drop-down list, select Year.

6. On the Default Values tab, perform the following steps. Then click OK.

• Select Get values from a query.

• In the Dataset drop-down list, select MostRecentSalesYear.

• In the Value field drop-down list, select MaxYear.


7. Click the Preview tab and note that the report is rendered using the most recent year (2004). Then, in
the Year drop-down list, select 2003 and click View Report. The report is then rendered with data
for sales in 2003.
8. Close SQL Server Data Tools.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 29

Lesson 6
Publishing and Viewing a Report
Contents:
Detailed Demonstration Steps 30
30 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Publishing a Report
Detailed demonstration steps
X Task 1: Configure a report project
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. Then, in the
D:\10778A\Demofiles\Mod02 folder, run Setup.cmd as Administrator.

2. Double-click ReportsDemo5.sln in the D:\107778A\Demofiles\Mod02 folder to open the solution in


SQL Server Data Tools.

3. In Solution Explorer, right-click the ReportDemo5 project and click Properties. Then set the
following properties and click OK:

• TargetDatasetFolder: http://mia-sqlbi/reports/demo/datasets

• TargetdataSourceFolder: http://mia-sqlbi/reports/demo/datasources

• TargetReportFolder: http://mia-sqlbi/reports/demo

• TargetReportPartFolder: http://mia-sqlbi/reports/demo/reportparts
• TargetServerURL: http://mia-sqlbi

X Task 2: Deploy a report project


1. On the Build menu, click Deploy ReportsDemo5.

2. Observe the deployment progress in the status bar and the Output pane.

X Task 3: View a published report


1. When deployment has succeeded, close SQL Server Data Tools, start Internet Explorer, and browse to
the SharePoint site at http://mia-sqlbi.

2. Under Libraries, click Reports. Then in the Reports document library, click the demo folder.
3. Click the Reseller Sales report and note that it is rendered in the SharePoint interface.

4. In the Parameters pane, in the Year drop-down list, select 2003, and click Apply. The report is
rendered again with the data for sales in 2003.

5. In the Actions menu, point to Export, and click excel. When prompted, save the report as Reseller
Sales.xlsx in the D:\107778A\Demofles\Mod02 folder – replacing the file if it already exists.

6. When the file has downloaded, click Open to view it in Excel.

7. Close Excel and Internet Explorer.


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 31

Module Reviews and Takeaways


Review questions
Question: As a professional BI developer, what tool should you generally use to create and
maintain reports?

Answer: You could use Report builder, but in most cases a professional report developer
should use Report Designer in SQL Server Data Tools.

Question: You need to create a report in which users can view a summary of sales totals for
each month of the year and drilldown into the individual sales for each month. How can you
achieve this?

Answer: You can create a group in the report based on the Month field, with an aggregate
total in the group header. You can then configure the Visibility properties of the details
group so that it is hidden by default and can be toggled by the textbox containing the
Month field in the Month group header row.

Question: You want to show a graphical representation of a company’s profit for the year
to-date compared to the target that was set at the beginning of the year. How can you
achieve this?

Answer: You could use a chart, but for this kind of single value visualization, a gauge is the
most appropriate choice.
32 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Module 3
Supporting Self Service Reporting
Contents:
Lesson 1: Introduction to Self Service Reporting 33

Lesson 2: Shared Data Sources and Datasets 37

Lesson 3: Report Parts 41

Module Reviews and Takeaways 45


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 33

Lesson 1
Introduction to Self Service Reporting
Contents:
Detailed Demonstration Steps 34
34 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Using Report Builder
Detailed demonstration steps
Task 1: Use Report Builder to create a report
1. Ensure MIA-DC1 and MIA-SQLBI are started, and log onto MIA-SQLBI as ADVENTUREWORKS\Student
with the password Pa$$w0rd. Then in the D:\10778A\Demofiles\Mod03 folder, run Setup.cmd as
Administrator.

2. Start Internet Explorer and browse to the Reports document library in the SharePoint site at
http://mia-sqlbi.

3. In the ribbon, on the Documents tab, in the New Document drop-down list, click Report Builder
Report. If you are prompted to install Report Builder, click Run, and wait for Report Builder to be
downloaded. The application starts automatically after it has been downloaded.
4. In the Getting Started dialog box, ensure that New Report is selected and click Table or Matrix
Wizard.

5. On the Choose a dataset page, ensure Create a dataset is selected, and click Next.

6. 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

• On the Credentials tab, ensure that the Use current Windows user. Kerberos delegation
might be required option is selected.

7. On the Design a query page, in the Database view pane, expand Tables, expand the
DimGeography, DimDate, DimCustomer, and FactInternetSales tables, and select the following
fields:
• DimDate.CalendarYear

• DimDate.MonthNumberOfYear

• DimDate.EnglishMonthName
• DimGeography.EnglishCountryRegionName

• DimCustomer.GeographyKey

• FactInternetSales.CustomerKey

• FactInternetSales.OrderDateKey

• FactInternetSales.SalesAmount

8. After you have selected the fields, click Run Query and note that no rows are returned. Then expand
the Relationships pane, review the relationships that have been automatically detected, and note
that the FactInternetSales table is joined to the DimDate table on three fields (OrderDateKey,
DueDateKey, and ShipDateKey).
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 35

9. Click Edit as Text and modify the query to remove the AND clauses that join the FactInternetSales
table to the DimDate table on the DueDateKey and ShipDateKey columns and click the Run button
to verify that the query now returns data. Then click Next.

Note This step highlights the fact that some knowledge of query syntax may be required
to define a dataset for a report. In a self-service reporting scenario, some users may not
have this knowledge. Later in this module, the use of shared data sources and datasets to
overcome this problem is discussed.

10. On the Arrange fields page, drag and drop the fields to the following groups and then click Next.

• Row groups
EnglishCountryRegionName

• Column groups

CalendarYear

EnglishMonthName

• Values

SalesAmount

11. On the Choose the layout page, ensure that Show subtotals and grand totals and
Expand/collapse groups are all selected, and then click Next.

12. On the Choose a style page, in the Styles list, select Generic. Then click Finish.
13. In the Click to add title text box, type Sales Report. Then click Run to preview the report, and then
click Design and widen columns as necessary.

X Task 2: Publish a report from Report Builder


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 Demo Sales Report.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 Demo Sales Report has been published in the
Reports document library. Then click Demo Sales Report and view the report.

X Task 3: Use Report builder to edit an existing report


1. When viewing the report, at the top of the page click the Reports link to return to the Reports
document library. Then, on the drop-down menu for Demo Sales Report, click Edit in Report
Builder.

2. Click the cell containing the expression [Sum(SalesAmount)] directly beneath the
[EnglishMonthName] 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. In the Groupings pane, in the EnglishMonthName group drop-down list, click Group Properties.
Then on the Sorting tab, change the Sort by field to MonthNumberOfYear so that the months are
36 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

sorted in calendar order, and click OK. Then, in the quick access toolbar, click Save. Then close Report
Builder.

4. In Internet Explorer, in the Reports document library, click Demo Sales Report to view the report
and note that your changes have been published to the report server. Then close Internet Explorer.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 37

Lesson 2
Shared Data Sources and Datasets
Contents:
Detailed Demonstration Steps 38
38 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Using a Shared Data Source
Detailed demonstration steps
X Task 1: Create a shared data source
1. Ensure MIA-DC1 and MIA-SQLBI are started, and log onto MIA-SQLBI as ADVENTUREWORKS\Student
with the password Pa$$w0rd. Then in the D:\10778A\Demofiles\Mod03 folder, run Setup.cmd as
Administrator.

2. Start Internet Explorer and browse to the Reports document library in the SharePoint site at
http://mia-sqlbi.

3. In the ribbon, on the Documents tab, in the New Document drop-down list, click Report Data
Source.

4. In the Data Source Properties page, configure a data source with the following settings and click
OK.

• Name: Demo Adventure Works DW

• 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

X Task 2: Use a shared data source in a report


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 Report and click Table or
Matrix Wizard.

3. On the Choose a dataset page, ensure Create a dataset is selected, and click Next.

4. On the Choose a connection to a data source page, click Browse and browse to the http://mia-
sqlbi/Reports folder. Then select the Demo Adventure Works DW.rsds shared data source you
created in the previous task and click Open. Then ensure that the Demo Adventure Works
DW.rsds data source is selected, and click Next.

5. On the Design a query page, in the Database view pane, expand Tables, expand the
DimCustomer, DimGeography, and FactInternetSales tables, and select the following fields:

• DimGeography.EnglishCountryRegionName
• DimCustomer.GeographyKey

• FactInternetSales.CustomerKey

• FactInternetSales.SalesAmount

6. Expand the Relationships pane, review the relationships that have been automatically detected. Then
click Next.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 39

7. On the Arrange fields page, drag and drop the fields to the following groups and then click Next.

• Row groups

EnglishCountryRegionName

• Values

SalesAmount

8. On the Choose the layout page, ensure that Show subtotals and grand totals is selected, and then
click Next.

9. On the Choose a style page, in the Styles list, select any style. Then click Finish.

10. In the Report data pane, expand Data Sources and then right-click the data source used by the
report and click Data Source Properties. Note that the data source is a reference to the Demo
Adventure Works DW.rsds shared data source you created earlier, and then click OK.

11. Format the report as necessary - for example, format the [Sum(SalesAmount)] fields as currency and
widen the columns.

12. Click Run to preview the report, and then close Report Builder without saving the report. Then close
Internet Explorer.

Demonstration: Using a Shared Dataset


Detailed demonstration steps

Note This demonstration requires that you have completed the previous demonstration in
this module. If you have not done so, you must create a shared data source named Demo
Adventure Works DW.rsds that connects to the AdventureWorksDW database in the
localhost instance of SQL Server.

X Task 1: Create a shared dataset


1. Ensure MIA-DC1 and MIA-SQLBI are started, and log onto MIA-SQLBI as ADVENTUREWORKS\Student
with the password Pa$$w0rd. Then in the D:\10778A\Demofiles\Mod03 folder, run Setup.cmd as
Administrator.

2. Start Internet Explorer and browse to the Reports document library in the SharePoint site at
http://mia-sqlbi.

3. In the ribbon, on the Documents tab, in the New Document drop-down list, click Report Builder
Report.

4. When Report Builder starts, in the Getting Started dialog box, select New Dataset and select the
Demo Adventure Works DW.rsds data source you created in the previous demo. If Demo
Adventure Works DW.rsds is not listed, click Browse other data sources and browse to the
http://mia-sqlbi/Reports folder. Then select the Demo Adventure Works DW.rsds shared data
source and click Open. When you have selected the Demo Adventure Works DW.rsds data source,
click Create.
5. On the ribbon, in the Query Designer section, click Import. Then browse to the
D:\10778A\Demofiles\Mod03 folder, select Internet Sales.sql, and click Open.
40 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

6. On the ribbon, click the Run button. When the query has completed, review the results, which show
Internet sales data.

7. 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 Demo Internet Sales.rsd, and save the
dataset.

X Task 2: Use a shared dataset in a report


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 Demo Internet Sales.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 any style. Then click Finish.

6. Format the report as necessary - for example, format the [Sum(SalesAmount)] fields as currency and
widen the columns.
7. 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.

8. Click Run to preview the report, and then close Report Builder without saving the report. Then close
Internet Explorer.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 41

Lesson 3
Report Parts
Contents:
Detailed Demonstration Steps 42
42 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Using Report Parts
Detailed demonstration steps
X Task 1: Create and publish a report part
1. Ensure MIA-DC1 and MIA-SQLBI are started, and log onto MIA-SQLBI as ADVENTUREWORKS\Student
with the password Pa$$w0rd. Then in the D:\10778A\Demofiles\Mod03 folder, run Setup.cmd as
Administrator.

2. Start Internet Explorer and browse to the Reports document library in the SharePoint site at
http://mia-sqlbi.

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.
4. In the Getting Started dialog box, ensure that New Report is selected and click Chart Wizard.

5. On the Choose a dataset page, ensure Create a dataset is selected, and click Next.

6. 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

• On the Credentials tab, ensure that the Use current Windows user. Kerberos delegation
might be required option is selected.

7. On the Design a query page, click Import and browse to the D:\10778A\Demofiles\Mod03 folder,
select SalesByYear.sql, and click Open. Then on the toolbar, click the Run button to verify that the
query returns sales volumes for years and product categories, and click Next.

8. On the Choose a chart type page, select Line, and click Next.

9. On the Arrange chart fields page, drag CalendarYear to the Categories list, drag ProductCategory
to the Series list, and drag SalesAmount to the Values list. Then click Next.

10. On the Choose a style page, select Generic, and then click Finish.

11. When the report has been created, click the Chart Title text box and then select the text and change
it to Sales Trend. Then resize the chart to make it bigger.

12. Click Run to preview the chart and then click Design to return to design view.

13. 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 DemoSalesTrendChart.

14. 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 DemoSalesByYear and click
OK.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 43

15. 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.

16. In the Publish Report Parts dialog box, expand DemoSalesTrendChart and in the description box,
type Chart showing sales by category over time. Then click Publish, and when the Result message
shows that a report part was published successfully, click Close.

X Task 2: Use a report part in a report


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 Sales and click the search button. Note that
the DemoSalesTrendChart report part you published in the previous task is listed in the results.

4. Drag the DemoSalesTrendChart 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 Chocolate and click OK.

6. Click the Click to add title textbox and type Sales Report.
7. On the Home tab, click Run to preview the report and note that the report part is shown with the
chocolate 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 Demo Sales Report – Line Chart.rdl, and click
Save.

X Task 3: Update 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 Blank Report.

2. Drag the DemoSalesTrendChart report part from the Report Parts Gallery pane to the body of the
report.

3. 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 Sea green and click OK.

4. 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.

5. In the Publish Report Parts dialog box, expand DemoSalesTrendChart and ensure that the Publish
as a new copy of the report part checkbox is not selected. Then click Publish, and when the
Result message shows that a report part was published successfully, click Close.
6. Click the round button at the top left of the ribbon, and on the Report Builder menu, in the Recent
Documents list, click Demo Sales Report – Line Chart.rdl. Do not save the current report from
which you republished the report part.
44 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

7. Wait for a few moments until the Updated Report Parts message appears under the ribbon. Then
click View Updates.

8. In the Update Report Parts dialog box, select the DemoSalesTrendChart report part and click
Update. Then click Close and note that the report has been updated with the new version of the
report part.

9. Save the report and close Report Builder and Internet Explorer.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 45

Module Reviews and Takeaways


Review questions
Question: How can you enable business users to create reports without them needing to
define connection strings for databases?

Answer: Create shared data sources that encapsulates the connection information for each
database that can be used as a source for reports.

Question: How can you simplify self-service reporting for business users who aren’t familiar
with query syntax?

Answer: Create shared datasets that retrieve commonly used data for reports.

Question: How can you create a standard gauge that multiple business users can include in
their reports?

Answer: Create the gauge in a report and then publish it as a report part.
46 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Module 4
Managing Report Execution and Delivery
Contents:
Lesson 1: Managing Report Security 47

Lesson 2: Managing Report Execution 49

Lesson 3: Subscriptions and Data Alert 51

Lesson 4: Troubleshooting Reporting Services 55

Module Reviews and Takeaways 57


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 47

Lesson 1
Managing Report Security
Contents:
Additional Reading 48
48 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Additional Reading
Managing Authentication
• Kerberos Documentation for Windows
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 49

Lesson 2
Managing Report Execution
Contents:
Detailed Demonstration Steps 50
50 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Configuring Report Execution
Detailed demonstration steps
X Task 1: Configure credentials for a data source
1. Ensure MIA-DC1 and MIA-SQLBI are started, and log onto MIA-SQLBI as ADVENTUREWORKS\Student
with the password Pa$$w0rd. Then in the D:\10778A\Demofiles\Mod04 folder, run Setup.cmd as
Administrator.

2. In the D:\10778A\Demofiles\Mod04 folder, double-click AWReports.sln to open the solution in SQL


Server Data Tools. Then in Solution Explorer, right-click AWReports and click Deploy. When
deployment is complete, close SQL Server Data Tools.

3. Start Internet Explorer and browse to SharePoint site at http://mia-sqlbi, and in the Reports
document library, click Demo to view the contents of the Demo folder.
4. 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.

5. 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.

6. In the Credentials section, select the Stored credentials option and enter the following credentials:
• User Name: ADVENTUREWORKS\ServiceAcct

• Password: Pa$$w0rd

7. Select Use as Windows credentials and click Test Connection. Then when the connection has been
tested successfully, click OK.

X Task 2: Configure caching for a report


1. In the Demo folder, 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 note the execution date and time under the report heading.

5. At the top of the report page, click the demo link to return to return to the Demo folder, and then
click Monthly Sales Report again. Note that the execution date and time have not changed because
the report has been cached.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 51

Lesson 3
Subscriptions and Data Alerts
Contents:
Detailed Demonstration Steps 52
52 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Using Subscriptions
Detailed demonstration steps

Note This demonstration requires that you have completed the previous demonstration in
this module.

X Task 1: Subscribe to a report


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

2. On the Actions menu, click Subscribe.

3. In the Delivery Extension drop-down list, select Windows File Share, and then enter the following
settings, and then click OK:
• File name: MonthlySalesReport

• Path: \\MIA-SQLBI\SharedReports

• Render Format: Excel


• Write mode: Overwrite

• File Extension: True

• Delivery Event: On a custom schedule. Click Configure and define a custom schedule that will
send the report daily, 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.

• User name: ADVENTUREWORKS\ServiceAcct

• Password: Pa$$w0rd

• Parameters: Use Report Default Value

4. At the top of the report page, click the demo link to return to return to the Demo folder.

5. In the drop-down list for the Monthly Sales Report report, click Manage Subscriptions. Then view
the information about the Windows File Share subscription you created in the previous task.

6. Wait two minutes and then refresh the page. The Last Results column should indicate that
subscription has run. Then minimize Internet Explorer with the Manage Subscriptions page still open

7. View the contents of the D:\10778A\Demofiles\Mod04\SharedReports folder and verify that the
report has been created.

X Task 2: Create a data-driven subscription


1. In the D:\10778A\Demofiles\Mod04 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
ReportSubscriptionsDemo, which contains the following columns:
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 53

• 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.

3. Click Execute to run the query. Then when it has completed, close SQL Server Management Studio.

4. Maximize Internet Explorer, and in the Manage Subscriptions page for the Monthly Sales Report
report, click Add data-Driven Subscription.

5. In the Description text box, type Weekly Sales Report. Then, in the Connection Type section, select
Shared data source, in the Data Source Link section, click the ellipsis (…) button, and in the Select
an Item dialog box, select the AdventureWorksDW data source and click OK.
6. In the Query section, type SELECT * FROM ReportSubscriptionsDemo and click Validate. When the
query is validated successfully, click Next.

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.

• 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)

9. In the Delivery Event section, ensure that On a custom schedule is selected.

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.


13. 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.

14. View the contents of the C:\inetpub\mailroot\Drop folder and note the email messages that have
been received by the local SMTP server.

15. Open the three most recent messages, and verify that the report has been sent in Excel, Word, and
embedded HTML formats.

16. Close all attachments, email messages, and folder windows.


54 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Demonstration: Creating a Data Alert


Detailed demonstration steps

Note This demonstration requires that you have completed the first demonstration in this
module.

X Task 1: Create a data alert


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

2. On the Actions menu, click New Data Alert.

3. In the New Data Alert – Monthly Sales Report dialog box, in the Report data name drop-down
list, select Tablix1.

4. Click Add rule and click Product Category, then in the drop-down list for the rule value, click Bikes.
This creates a rule that sends an alert of the report data includes any sales for the Bikes product
category.

5. Under Schedule settings, change Daily to Minute, and ensure that the alert is scheduled for every 1
minute(s).
6. In the Email settings section, change the Recipient(s) value to student@adventureworks.msft,
and then click Save.

7. Minimize Internet Explorer and view the contents of the C:\inetpub\mailroot\Drop folder. Then wait
for a minute and refresh the folder until a new e-mail message appears.

8. Double-click the new e-mail message to view the alert. Then close the e-mail message and the folder
window.

X Task 2: Manage data alerts


1. Maximize Internet Explorer, and above the report, click the demo link to view the demo folder.

2. In the drop-down list for the Monthly Sales Report report, click Manage Data Alerts.

3. Note that the alert you created previously is listed and that the Last Run and Status columns provide
information about when the alert was last sent.

4. Right-click the alert, and on the shortcut menu that appears, click Delete.

5. Close Internet Explorer.


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 55

Lesson 4
Troubleshooting Reporting Services
Contents:
Additional Reading 56
56 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Additional Reading
Reporting Services Logs
• For more information about execution logging, see Report Server Execution Log and the
ExecutionLog3 View in SQL Server Books Online.

Monitoring Reporting Services Performance


• For a full list of counters provided by the MSRS 2011 Web Service and MSRS 2011 SharePoint
Mode Web Service performance objects, see Performance Counters for the MSRS 2011 Web Service
Performance Object in SQL Server Books Online.

• For a full list of counters provided by the MSRS 2011 Windows Service and MSRS 2011 Windows
Service SharePoint Mode performance objects, see Performance Counters for the MSRS 2011
Windows Service Performance Object in SQL Server Books Online.
• For a full list of counters provided by the ReportServer:Service and
ReportServerSharePoint:Service performance objects, see Performance Counters for the
ReportServer:Service Performance Object in SQL Server Books Online.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 57

Module Reviews and Takeaways


Review questions
Question: How can you ensure that the sales manager can view reports that are published in
a SharePoint library?

Answer: Ensure that the Windows account used by the sales manager is a member of at
least the Visitors group in the SharePoint library.

Question: You want to reduce the time it takes to render a report that contains a lot of data.
How can you achieve this?

Answer: You could cache the report or the dataset is uses. Alternatively, you could schedule
the creation of snapshots from the report and have users view the snapshots instead of the
live report.

Question: You want to publish a report as an Excel document in a SharePoint document


library on a weekly basis. How can you accomplish this?

Answer: Create a subscription that delivers the report in Excel format to the SharePoint
document library.
58 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Module 5
Creating Multidimensional Databases
Contents:
Lesson 2: Creating Data Sources and Data Source Views 59

Lesson 3: Creating a Cube 62

Lesson 4: Overview of cube securit 65

Module Reviews and Takeaways 68


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 59

Lesson 2
Creating Data Sources and Data Source Views
Contents:
Detailed Demonstration Steps 60
60 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Creating a Data Source and a Data Source View
Detailed demonstration steps
X Task 1: Create a new SSAS project
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. Then in the
D:\10778A\Demofiles\Mod05 folder, run Setup.cmd as Administrator.

2. Click Start, click All Programs, click Microsoft SQL Server 2012, and then click SQL Server Data
Tools.

3. Click New Project.

4. Select Analysis Services Multidimensional and Data Mining Project.

5. In the Name field, type Demo.


6. In the Location field, type D:\10778A\Demofiles\Mod05, and then click OK.

X Task 2: Create a data source for the AdventureWorksDW relational database


1. In Solution Explorer, right-click Data Sources, 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 Server name field, type localhost.

5. In the Select or enter a database name field, click AdventureWorksDW, and then click OK.
6. Click Next.

7. Click Use a Specific Windows user name and password, and enter the user name
ADVENTUREWORKS\Student and the password Pa$$w0rd. Then click Next.

8. In the Data source name field, type AdventureWorks Demo DS, and then click Finish.

X Task 3: Create a data source view


1. In Solution Explorer, right-click Data Source Views, and then click New Data Source View.

2. On the Welcome to the Data Source View Wizard page, click Next.
3. Ensure that AdventureWorks Demo DS is selected, and then click Next.

4. Select the DimCustomer, DimDate, DimGeography, DimProduct, and FactInternetSales tables,


and then add them to Included objects.

5. Click Next.

6. In the Name field, type AdventureWorks Demo DSV, and then click Finish.

X Task 4: Modify the data source view


1. In Solution Explorer, right-click AdventureWorks Demo DSV, and then click Open.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 61

2. In Data Source Designer, navigate through the database diagram until you locate the
FactInternetSales table.

3. Click the table name of the FactInternetSales table and press F4.

4. In the Properties pane, change the FriendlyName property to Internet Sales.

5. Right-click the DimCustomer table, and then click New Named Calculation.
6. In the Column name field, type Full Name.

7. In the Expression field, type FirstName + ' ' + LastName, and then click OK.

8. On the File menu, click Save All. Then minimize SQL Server Data Tools. You will return to it in a later
demonstration.
62 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 3
Creating a Cube
Contents:
Detailed Demonstration Steps 63
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 63

Detailed Demonstration Steps


Demonstration: Creating and Browsing a Cube
Detailed demonstration steps
X Task 1: Create a cube
1. Ensure that you have completed the previous demonstration in this module.

2. Maximize SQL Server Data Tools, which should be open with the Demo project loaded.

3. In Solution Explorer, right-click Cubes, and click New Cube.

4. On the Welcome to the Cube Wizard page, click Next.

5. On the Select Creation Method page, ensure that Use existing tables is selected, and click Next.

6. On the Select Measure Group Tables page, click Suggest. Then note that the wizard identifies
Internet Sales as a measure group table, and click Next.

7. On the Select Measures page, clear the Internet Sales checkbox to clear all selections, and then
select the Total Product Cost and Sales Amount measures. Then click Next.

8. On the Select New Dimensions page, clear the parent Internet Sales checkbox, and click Next.

9. On the Completing the Wizard page, change the cube name to Demo Cube and click Finish. The
cube is created and opened in the cube designer.

X Task 2: Deploy and browse a cube


1. In Solution Explorer, right-click Demo and click Deploy. If prompted, enter the password Pa$$w0rd
for the ADVENTUREWORKS\Student user. Then wait for the deployment process to finish.

2. In the cube designer, click the Browser tab.

3. In the Metadata pane, expand Measures and expand Internet Sales. The wizard has created the
measures you selected.
4. Drag the Sales Amount measure to the Drag levels or measures here to add to the query area.
The total sales amount for all Internet sales is shown.

5. In the Metadata pane, note that the wizard has created dimensions for the DimCustomer and
DimProduct tables. It has also determined that there are three relationships defined between the
Internet Sales table and the DimDate table, and so has a dimension for each related column (Due
Date, Order Date, and Ship Date).

6. Expand each of the dimensions and note the wizard has only created attributes for key columns. You
will need to modify the dimensions to add meaningful attributes for analysis.

7. Drag the Product Key attribute from the Dim Product dimension and drop it to the left of the Sales
Amount value in the grid. The browser now shows the aggregated sales amount totals for each
product key.

X Task 3: Customize cube measures and dimensions


1. In the cube designer, click the Cube Structure tab. Then, in the Measures pane, expand Internet
Sales.
64 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

2. Right-click the Total Product Cost measure and click Rename. Then change the name of the
measure to Cost.

3. In the Dimensions pane, right-click Dim Customer and click Rename, and change the name of the
dimension to Customer. Then rename Dim Product to Product.

4. Right-click the Product dimension and click Edit Dimension. This opens the dimension designer for
the Dim Product dimension (the dimension is named Product in the Demo Cube cube, but still
named Dim Product in the database).

5. In the Data Source View pane, in the DimProduct table, drag the EnglishProductName field to the
Attributes pane.

6. In the Attributes pane, right-click English Product Name and click Rename. Then rename the
attribute to Product Name.

7. In Solution Explorer, right-click Demo and click Deploy. If prompted, enter the password Pa$$w0rd
for the ADVENTUREWORKS\Student user. Then wait for the deployment process to finish.

8. Click the Demo Cube.cube [Design] tab to return to the cube designer, and then in the cube
designer, click the Browser tab.

9. On the Browser tab, click the Reconnect button in the upper left. If the grid contains any data from
previous queries, right-click in the grid and click Clear Grid.
10. In the Metadata pane, expand Measures and Internet Sales, and drag Cost to the Drag levels or
measures here to add to the query area.

11. Expand the Product dimension, and then drag Product Name to the left of the Cost value. The total
cost associated with sales for each product is shown.

12. On the File menu, click Save All, and then minimize SQL Server Data Tools. You will use it again in a
later demonstration.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 65

Lesson 4
Overview of Cube Security
Contents:
Detailed Demonstration Steps 66
66 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Applying Cube Security
Detailed demonstration steps
X Task 1: Create a role
1. Ensure that you have completed the previous demonstration in this module.

2. Maximize SQL Server Data Tools, which should be open with the Demo project loaded.

3. In Solution Explorer, right-click Roles, and click New Role. Then in Solution Explorer, right-click the
Role.role icon that has been added, click Rename, and change the name to Restricted User.role.
when prompted to change the object name as well, click Yes.

4. In the role designer, on the General tab, note that by default this role has no database permissions.

5. On the Membership tab, note that this is where you can add Windows users and groups to the role.

6. On the Data Sources tab, note that by default the role has no access to any data sources.
7. On the Cubes tab, change the Access value for Demo Cube to Read. This allows the role to access
the cube and read its data.

8. On the Cell Data tab, note that this is where you can specify MDX statements that define cells in the
cube which you want to permit or deny this role to access.

9. On the Dimensions tab, note that the role has Read access to all dimensions in the database. Then in
the Select Dimension Set list at the top of the page, click Demo Cube cube dimensions and note
that these permissions are inherited by the dimensions in the Demo Cube cube.

10. On the Dimension Data tab, in the Dimension list, under Demo Cube, select Measures Dimension.
Then on the Basic tab, clear the checkbox for the Cost measure.
11. In the Dimension list, under Demo Cube, select Product, and on the Basic tab, in the Attribute
hierarchy list, select Product Name.

12. Select Deselect all members. Then scroll to the bottom of the list of product names and select only
the products that begin with the word Touring.

13. On the File menu, click Save All.

X Task 2: Test a role


1. In Solution Explorer, right-click Demo and click Deploy. If prompted, enter the password Pa$$w0rd
for the ADVENTUREWORKS\Student user.

2. When deployment is complete, in Solution Explorer, double-click Demo Cube.cube to return to the
cube designer.

3. On the Browser tab, click the Reconnect button at the top left. If the grid contains any data from
previous queries, right-click in the grid and click Clear Grid.

4. In the Metadata pane, expand Measures and Internet Sales, and drag Sales Amount and Cost to
the Drag levels or measures here to add to the query area. Then expand the Product dimension
and drag Product Name to the left of the measure values. The browser shows cost and sales amount
for all products.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 67

5. In the top left area of the browser window, click the Change User button. Then, in the Security
Context – Demo Cube dialog box, select Roles, and in the drop-down list, select Restricted User
and click OK. Click OK again to return to the browser window.

6. Note that the grid has been cleared. Then, in the Metadata pane, expand Measures and Internet
Sales, and drag Sales Amount to the Drag levels or measures here to add to the query area. Note
that members of this role cannot access the Cost measure.

7. Expand the Product dimension and drag Product Name to the left of the measure values. The
browser shows sales amount for only the Touring products.

8. On the File menu, click Save All, and then close SQL Server Data Tools.
68 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Module Reviews and Takeaways


Review questions
Question: What are some of the name matching methods available when creating a data
source view?

Answer: Some of the name matching methods that are available when creating a data
source view include Same name as primary key, Same name as destination table name,
Destination table name + primary key name.

Question: How can you use the Cube Designer to configure a cube after it has been
created?

Answer: You can do this by using the Cube Structure tab, the Dimension Usage tab, or
other tabs of Cube Designer as needed.

Question: After creating a data source by using the Data Source Wizard, what tool would
you use to modify the data source?

Answer: You would use Data Source Designer to modify the data source.

Question: How do time dimensions differ from other dimensions?


Answer: Time dimensions contain inherent functionality that groups the members into
levels, such as days, weeks, months, and years.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 69

Module 6
Working with Dimensions
Contents:
Lesson 1: Configuring Dimensions 70

Lesson 2: Defining Attribute Hierarchies 72

Module Reviews and Takeaways 75


70 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 1
Configuring Dimensions
Contents:
Additional Reading 71
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 71

Additional Reading
Dimension Types
• how to Add Account Intelligence to a Dimension

• Dimension Types
72 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 2
Defining Attribute Hierarchies
Contents:
Detailed Demonstration Steps 73

Additional Reading 74
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 73

Detailed Demonstration Steps


Demonstration: Creating a Parent-Child Hierarchy
Detailed demonstration steps
X Task 1: Create a Parent-Child Hierarchy
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. Then in the
D:\10778A\Demofiles\Mod06 folder, run Setup.cmd as Administrator.

2. In the D:\10778A\Demofiles\Mod06 folder, double-click Adventure Works OLAP.sln to open the


solution in SQL Server Data Tools.

3. In Solution Explorer, right-click Dimensions and click New Dimension.

4. On the Welcome to the Dimension Wizard page, click Next.

5. On the Select Creation Method page, select Use an existing table and click Next.
6. On the Specify Source Information page:

• In the Main Table box select DimEmployee.

• In the Key column list, ensure that EmployeeKey is selected.

• In the Name Column box select FullName.

• Click Next.

7. On the Select Related Tables page, ensure that DimSalesTerriroty is selected and click Next.
8. On the Select Dimension Attributes page, click Next.

9. On the Completing the Wizard page, in the Name box, type Employee and click Finish.

X Task 2: Name the Levels in a Parent-Child Hierarchy


1. On the Dimension Structure tab, In the Attributes section, click Parent Employee Key.
2. In the Properties pane click the ellipses (…) button for NamingTemplate.

3. In the Level Naming Template dialog box type Senior Management in the first blank cell.

4. Move down one cell and type Middle Management and move down another cell and type
Employee.

5. Click OK.

6. In the Properties pane change the MemebersWithData property value to NonLeafDataHidden.

7. In Solution Explorer, right-click Adventure Works OLAP and click Deploy. If prompted, specify the
password Pa$$w0rd for the ADVENTUREWORKS\Student user.

8. When deployment has completed, click the Browser tab and expand the employees in the hierarchy.
Note that when you select an employee, the hierarchy level name is displayed at the top of the
browser area.

9. Close SQL Server Data Tools.


74 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Additional Reading
Parent-Child Hierarchies
• Parent-Child Dimensions
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 75

Module Reviews and Takeaways


Review questions
Question: How do dimensions, attributes, and fact tables relate to one another?

Answer: Dimensions relate to fact tables using the key column attribute. Other attributes are
used to add hierarchies and provide additional information.

Question: Aside from organizational charts, where else might you find parent-child
hierarchies?

Answer: There is no correct or incorrect answer. Typically if you can assign a fact to a non-
leaf member it needs to be a parent child.

Question: When might you want to use a secondary attribute for sorting data?

Answer: You might want to sort an employee by last name although the key column is
employeeid and the name column is a full name calculated column.
76 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Module 7
Working with Measures and Measure Groups
Contents:
Lesson 1: Working with Measures 77

Lesson 2: Working with Measure Groups 79

Module Reviews and Takeaways 83


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 77

Lesson 1
Working with Measures
Contents:
Additional Reading 78
78 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Additional Reading
Introducing Measures
• For more information about aggregation, see the Aggregation Functions topic later in this lesson.

Aggregation Functions
• Configure Measure Properties
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 79

Lesson 2
Working with Measure Groups
Contents:
Detailed Demonstration Steps 80

Additional Reading 82
80 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Defining Relationships Between Dimensions and Measure
Groups
Detailed demonstration steps
X Task 1: Define a referenced relationship
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. Then in the
D:\10778A\Demofiles\Mod07 folder, run Setup.cmd as Administrator.

2. In the D:\10778A\Demofiles\Mod07 folder, double-click Adventure Works OLAP.sln to open the


solution in SQL Server Data Tools.

3. In Solution Explorer, right-click Adventure Works OLAP and click Deploy. If prompted, specify the
user name ADVENTUREWORKS\Student and the password Pa$$w0rd.

4. In Solution Explorer, double-click Adventure Works Cube.cube, and on the Browser tab, expand
Measures and Internet Sales and drag the Sales Amount measure to the Drag levels or measures
here to add to the query area. Then expand the Geography dimension and drag Country-Region
to the left of the Sales Amount value.

Note that the values for each region are the same. The aggregation is incorrect.

5. In Solution Explorer, right-click Geography.dim, and then click View Designer. Note that this
dimension is based on the Geography table and has a Country-Region attribute.

6. In Solution Explorer, right-click Customer.dim, and then click View Designer. Note that this
dimension is based on the Customer table, which includes a GeographyKey attribute that relates it
to the Geography table.

7. Click the tab for the Adventure Works Cube.cube, and on the Cube Structure tab, in the Data
Source View pane, note that there is no direct relationship between the InternetSales fact table and
the Geography dimension table.

8. On the Dimension Usage tab, click the intersection of the Internet Sales measure group and the
Geography dimension, click the ellipses (…) button.

9. In the Select relationship type list, select Referenced.

10. In the Intermediate dimension list, select Customer.

11. In the Reference dimension attribute list, select Geography Key, and in the Intermediate
dimension attribute list, select Geography Key.

12. Click OK.

13. In Solution Explorer, right-click Adventure Works OLAP and click Deploy. If prompted, specify the
user name ADVENTUREWORKS\Student and the password Pa$$w0rd.

14. Click the tab for the Adventure Works Cube.cube, and on the Browser tab, click the Reconnect
button. Then in the data grid area, click the Click to execute the query link.

Note that the values for each region are now correct.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 81

15. On the Dimension Usage tab, in the Dimensions list, right-click Geography, and then click
Rename.

16. Change the name of this cube dimension to Reseller Geography, and then press Enter to make this
name change take effect.
82 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Additional Reading
Partitions
• Remote Partitions
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 83

Module Reviews and Takeaways


Review questions
Question: Give an example of an additive measure, a semiadditive measure, and a
nonadditive measure.

Answer:

Additive: Sales Amount in a Sales measure group, which for example can be aggregated by
Sum across all dimensions.

Semiadditive: Balance in an Accounts measure group, which can be aggregated by Sum


across customers but by LastNonEmpty when aggregated by time.

Nonadditive: Profit Margin in a Sales measure group.

Question: What are the two ways in which you can partition a measure group?

Answer: Horizontal and vertical.

Question: How can you use aggregations to improve query response time?

Answer: Aggregations improve query response time by preparing the answers before the
questions are asked.
84 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Module 8
Introduction to MDX
Contents:
Lesson 1: MDX Fundamentals 85

Lesson 2: Adding Calculations to a Cube 87

Lesson 3: Using MDX to Query a Cube 90

Module Reviews and Takeaways 92


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 85

Lesson 1
MDX Fundamentals
Contents:
Additional Reading 86
86 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Additional Reading
What Is MDX?
• For more information about the DAX language, see Module 11, “Introduction to Data Analysis
Expressions (DAX).”
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 87

Lesson 2
Adding Calculations to a Cube
Contents:
Detailed Demonstration Steps 88

Additional Reading 89
88 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Using Named Sets in a Cube
Detailed demonstration steps
In this demonstration you will create a named set a browse the cube using this named set.

X Task 1: Define a Core Products named set


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. Then in the
D:\10778A\Demofiles\Mod08 folder, run Setup.cmd as Administrator.

2. In the D:\10778A\Demofiles\Mod08 folder, double-click click Adventure Works OLAP.sln to open it


in SQL Server Data Tools.
3. In Solution Explorer, right-click Adventure Works OLAP, and then click Deploy. If prompted, specify
the user name ADVENTUREWORKS\Student and the password Pa$$w0rd.
4. In Solution Explorer, double-click Adventure Works Cube.cube, and in the cube designer, click the
Calculations tab.
5. On the toolbar of the Calculations tab, click New Named Set.

6. In the Name box, change the name of the new named set to [Accessories].

7. On the Metadata tab, in the Calculation Tools pane, expand Product, expand Product Category,
expand Members, and then expand All.

8. Drag Accessories into the Expression box.

9. On the File menu, click Save All.

X Task 2: Browse the cube by using the new named set


1. In SQL Server Data Tools, on the Build menu, click Deploy Adventure Works OLAP. If you see a
warning that the database will be overwritten, click Yes.

2. When deployment has successfully completed, click the Browser tab.


3. In the Metadata pane, expand Measures, expand Reseller Sales, and then drag the Sales Amount –
Reseller Sales measure to the Drag levels or measures here to add to the query area.

4. In the Measure Group pane, expand the Product dimension, and then add the Product Category
hierarchy to the left of Sales Amount.

5. In the Measure Group pane, in the Product Category dimension, drag Accessories onto <Select
dimension>. The data now shows only sales for accessories.

6. Close SQL Server Data Tools.


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 89

Additional Reading
Useful MDX Functions (Non-Family Functions)
• For more information about the DAX language, see Module 11, “Introduction to Data Analysis
Expressions (DAX).”
• Multidimensional Expressions (MDX) Reference

Useful MDX Functions (Family Functions)


• Multidimensional Expressions (MDX) Reference
90 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 3
Using MDX to Query a Cube
Contents:
Additional Reading 91
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 91

Additional Reading
Using MDX in SQL Server Reporting Services
• For more information about Reporting Services, see Module 2, “Implementing Reports with SQL
Server Reporting Services,” Module 3, “Supporting Self-Service Reporting,” and Module 4, “Managing
Report Execution and Delivery.”
92 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Module Reviews and Takeaways


Review questions
Question: What do you use MDX queries and expressions for in SQL Server?Answer: You use
them to return data to a client application from an SSAS cube, format query results, perform
cube design tasks, and perform administrative tasks, including dimension and cell security.

Question: What are the three panes of the Calculations tab and what purpose does each
pane serve?Answer: You use the Script Organizer pane to create, organize, and select
calculations for editing; the Calculation Tools pane provides metadata, functions, and
templates with which to create calculations; the Calculation Expressions pane supports a
form view and a script view.

Question: How can you create named sets?Answer: By using the New Named Set
command on the Calculations tab of the Cube Designer.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 93

Module 9
Customizing Cube Functionality
Contents:
Lesson 1: Working with Key Performance Indicators 94

Module Reviews and Takeaways 97


94 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 1
Working with Key Performance Indicators
Contents:
Detailed Demonstration Steps 95
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 95

Detailed Demonstration Steps


Demonstration: Using KPIs
Detailed Demonstration Steps
X Task 1: Create a KPI
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. Then in the
D:\10778A\Demofiles\Mod09 folder, run Setup.cmd as Administrator.

2. In the D:\10778A\Demofiles\Mod09 folder, double-click Adventure Works OLAP.sln to open the


solution in SQL Server Data Tools.

3. In the Solution Explorer pane, right-click Adventure Works OLAP, and then click Deploy. If
prompted, specify the password Pa$$w0rd and click OK.

4. After deployment is complete, in Solution Explorer right-click Adventure Works Cube.cube, click
Open, and then click the KPIs tab.

5. On the toolbar of the KPIs tab, click New KPI.

6. In the Name box, type Reseller Revenue, and then in the Associated measure group list, click
Reseller Sales.

7. On the Metadata tab in the Calculation Tools pane, expand Measures, expand Reseller Sales, and
then drag the Sales Amount – Reseller Sales measure to the Value Expression box.

8. On the Metadata tab in the Calculation Tools pane, expand Measures, expand Sales Quota, and
then drag the Sales Amount Quota measure to the Goal Expression box.

9. Verify that Gauge is selected in the Status indicator list, and then type the following MDX expression
in the Status expression box (you can copy this from KPI Status Expression.txt in the demo folder):

Case
When
KpiValue("Reseller Revenue")/KpiGoal("Reseller Revenue")>=.95
Then 1
When
KpiValue("Reseller Revenue")/KpiGoal("Reseller Revenue")<.95
And
KpiValue("Reseller Revenue")/KpiGoal("Reseller Revenue")>=.5
Then 0
Else -1
End

10. Verify that Standard arrow is selected in the Trend indicator list, and then type the following
expression in the Trend expression box (you can copy this from KPI Trend Expression.txt in the
demo folder):

Case
When IsEmpty
(ParallelPeriod
([Date].[Calendar Date].[Calendar Year],1,
[Date].[Calendar Date].CurrentMember))
Then 0
When (
KpiValue("Reseller Revenue") -
96 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

(KpiValue("Reseller Revenue"),
ParallelPeriod
([Date].[Calendar Date].[Calendar Year],1,
[Date].[Calendar Date].CurrentMember))
/
(KpiValue ("Reseller Revenue"),
ParallelPeriod
([Date].[Calendar Date].[Calendar Year],1,
[Date].[Calendar Date].CurrentMember)))
>=.02
Then 1
When(
KpiValue("Reseller Revenue") -
(KpiValue ( "Reseller Revenue" ),
ParallelPeriod
([Date].[Calendar Date].[Calendar Year],1,
[Date].[Calendar Date].CurrentMember))
/
(KpiValue("Reseller Revenue"),
ParallelPeriod
([Date].[Calendar Date].[Calendar Year],1,
[Date].[Calendar Date].CurrentMember)))
<=.02
Then -1
Else 0
End

X Task 2: Browse a KPI


1. On the File menu, click Save All.

2. In SQL Server Data Tools, on the Build menu of, click Deploy Adventure Works OLAP.

3. When deployment has successfully completed, click Browser View on the toolbar of the KPIs tab,
and then click Reconnect.
4. In the top pane of the KPI browser, click Sales Territory (not Customer – Sales Territory) in the
Dimension list, click Sales Territory Key in the Hierarchy list, and then click Equal in the Operator
list.

5. In the Filter Expression list, expand All, select 1, 2, 3, 4, and 5, and then click OK.

6. Click anywhere in the KPI Browser pane to update the values for the Reseller Revenue KPI.

7. Close SQL Server Data Tools.


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 97

Module Reviews and Takeaways


Review questions
Question: How are KPIs useful to the business?

Answer: A KPI is frequently evaluated over time. Business executives frequently consume
KPIs that are grouped together in a business scorecard to obtain a quick and accurate
historical summary of business success.

Question: What value do Actions add to the business?

Answer: Actions enable business users to act upon the outcomes of their analyses. By saving
and reusing actions, end users can go beyond traditional analysis, which typically ends with
presentation of data, and initiate solutions to discovered problems and deficiencies, thereby
extending the business intelligence application beyond the cube. Actions can transform the
client application from a sophisticated data rendering tool into an integral part of the
enterprise's operational system. Instead of focusing on sending data as input to operational
applications, end users can "close the loop" on the decision-making process. This ability to
transform analytical data into decisions is crucial to the successful business intelligence
application.

Question: What objects can be displayed or hidden in a perspective?

Answer: Dimensions, Attributes, Hierarchies, Measure groups, Measures, Key Performance


Indicators (KPIs), Calculations (calculated members, named sets, and script commands), and
Actions.
98 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Module 10
Implementing a Tabular Data Model with Microsoft
PowerPivot
Contents:
Lesson 1: Introduction to Tabular Data Models and PowerPivot Technologies 99

Lesson 2: Creating a Tabular Data Model by Using PowerPivot for Excel 101

Lesson 3: Sharing a PowerPivot Workbook and Using PowerPivot Gallery 106


Module Reviews and Takeaways 108
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 99

Lesson 1
Introduction to Tabular Data Models and PowerPivot
Technologies
Contents:
Additional Reading 100
100 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Additional Reading
What Is a Tabular Data Model?
• For more information about DAX, see Module 11 of this course, Introduction to DAX.

Options for Creating Tabular Data Models


• For more information about tabular data models in SQL Server 2012 Analysis Services, see Module 12
of this course, Implementing a Microsoft SQL Server Analysis Services Tabular Data Model.

Installing PowerPivot for SharePoint


• PowerPivot Configuration in Central Administration Web

• PowerPivot Configuration using PowerShell

• PowerPivot for SharePoint Installation

• how to Configure Kerberos Authentication for SharePoint 2010 Products


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 101

Lesson 2
Creating a Tabular Data Model by Using PowerPivot for
Excel
Contents:
Detailed Demonstration Steps 102

Additional Reading 105


102 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Creating a PowerPivot Workbook
Detailed demonstration steps
X Task 1: Create a PowerPivot Workbook
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. Then in the
D:\10778A\Demofiles\Mod10 folder, run Setup.cmd as Administrator.

2. Start Microsoft Excel 2010, and on the ribbon, click the PowerPivot tab.

3. On the ribbon, click PowerPivot Window. Note that the workbook window is still open, and you can
switch between the windows by clicking the Excel icon on the task bar or by clicking the Switch to
Workbook button in the title bar of the PowerPivot window.

4. In the PowerPivot window, on the ribbon, in the Get External Data area, click From Database, and
then click From SQL Server.

5. In the Table Import Wizard dialog box, change the Friendly connection name to Adventure
Works DW; in the Server name box, type localhost; select Use Windows Authentication, and in
the Database name list, click AdventureWorksDW. Then click Next.

6. On the Choose How to Import the Data Page, choose the option to select from a list of tables and
views, and click Next.
7. On the Select Tables and Views page, select the FactResellerSales table and then click Select
Related Tables.

8. Review the tables that were selected, and unselect DimCurrency and DimPromotion. Then select
DimGeography, DimProductSubcategory and DimProductCategory (which were not
automatically selected because they are not directly related to FactInternetSales).

9. Change the Friendly Name for all selected tables to remove the Dim or Fact prefix.

10. Click the rows for the DimProductCategory table, and then click Preview and Filter. Then in the
Preview Selected Table dialog box, uncheck the SpanishProductCategoryName,
FrenchProductCategoryName, and Image column headers and click OK. This removes columns you
do not plan to use in the data model.

11. Click Finish to create the data model, and when the data for all tables is imported, click Close.

12. Click each tab at the bottom of the PowerPivot window to view the tables in the model. Then, on the
ribbon, in the View section, click Diagram View. This shows the relationships between the tables in
the data model.

13. On the ribbon, in the View section, click Data View to return to the tabbed tables, and click the
ProductCategory tab.

14. Double-click the column header for EnglishProductCategoryName and change the name to
Category.

15. Close the PowerPivot window (but not the Excel workbook).
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 103

X Task 2: Create a PivotTable from a PowerPivot Data Model


1. In Excel, on the PowerPivot tab, click the PivotTable drop-down button and click PivotTable.

2. In the Create PivotTable dialog box, select Existing Worksheet, and click OK.

3. In the PowerPivot Field List pane, expand the ResellerSales table and select SalesAmount. The
total sales amount value is added to the PivotTable.

4. Expand the ProductCategory table and select Category. The sales amount is now aggregated by
product category. Note that PowerPivot has automatically used the relationship from ResellerSales
to ProductCategory through the Product and ProductSubcategory tables in order to aggregate
the data.

5. Close Excel without saving the workbook.

Demonstration: Creating a Hierarchy


Detailed demonstration steps
X Task 1: Create a hierarchy
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. Then in the
D:\10778A\Demofiles\Mod10 folder, run Setup.cmd as Administrator.

2. In the D:\10778A\Demofiles\Mod10 folder, double-click Demo.xlsx to open it in Microsoft Excel.

3. On the ribbon, click the PowerPivot tab, and then click PowerPivot Window. The PowerPivot
window may open behind the workbook, so minimize the workbook so you can see it.

4. In the PowerPivot window, on the ribbon, in the Get External Data area, click the Refresh drop-
down button and click Refresh All. In the Data Refresh dialog box, when all tables have been
refreshed, click Close.

5. In the PowerPivot window, on the ribbon, in the View area, click Diagram View.

6. In the Sales Territory table, right-click the Sales Territory table header, click Create Hierarchy.,
type Location, and then press Enter.

7. In the Sales Territory table, click Sales Territory Group, drag it onto the Location hierarchy, and
then release it.

8. In the Sales Territory table, click Country, drag it onto the Location hierarchy, and then release it.

9. In the Sales Territory table, click Sales Territory Region, drag it onto the Location hierarchy, and
then release it.

10. Close the PowerPivot window, and return to the workbook and save it, but do not close it. You will
return to it in a later demonstration.

Demonstration: Creating a PivotTable Table and a Slicer


Detailed demonstration steps
X Task 1: Create a PivotTable table
1. In the Demo.xlsx workbook, click the Demo worksheet tab.
104 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

2. Click in cell B2. On the ribbon, on the PowerPivot tab, click PivotTable, and then click PivotTable.

3. In the Create PivotTable dialog box, select Existing Worksheet, and then click OK.

4. In the PowerPivot Field List, expand Reseller Sales, and then select Total Profit to add this column
to the Values area.

5. In the PowerPivot Field List, expand Sales Territory, and then select Location.

X Task 2: Create a slicer


1. Expand Date, and then drag Calendar Year to the Slicers Horizontal area.

2. In the slicer, click 2001, and then wait for the data in the PivotTable table to update.

3. Repeat the previous step for 2002, 2003, and 2004.


4. Click the Clear Filter button.

5. Save and close Demo.xlsx.


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 105

Additional Reading
Creating and Managing Table Relationships
• For more information about multiple relationships, see the Multiple Relationships topic in Module 11
of this course, Introduction to DAX.
106 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 3
Sharing a PowerPivot Workbook and Using PowerPivot
Gallery
Contents:
Detailed Demonstration Steps 107
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 107

Detailed Demonstration Steps


Demonstration: Sharing a PowerPivot for Excel Workbook to PowerPivot
Gallery
Detailed demonstration steps
X Task 1: Share a PowerPivot for Excel workbook to PowerPivot Gallery
1. Click Start, and then click Internet Explorer.

2. On the Adventure Works Portal - Home page, in the Libraries list, click PowerPivot Gallery.

3. On the ribbon, click the Documents tab, click the Upload Document drop-down button, and then
click Upload Document.

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

5. In the Choose File to Upload box, navigate to D:\10778A\Demofiles\Mod10, click Demo.xlsx, and
then click Open.

6. In the PowerPivot Gallery – Upload Document dialog box, click OK. If the PowerPivot Gallery –
Demo.xlsx dialog box appears, click Save.

7. When the large Demo icon appears in the PowerPivot gallery, click it to open the workbook in Excel
Services in the SharePoint site.

8. Click the 2001 slicer and verify that you can interact with the shared workbook.
9. At the top of the workbook page, in the breadcrumbs trail, click Adventure Works Portal. Then
close Internet Explorer.
108 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Module Reviews and Takeaways


Review questions
Question: What are the differences between multidimensional data models and tabular data models?
Why might you choose to create one rather than the other?

Answer: Multidimensional models consist of cubes and dimensions and use Multidimensional
Expressions (MDX). You create them by using Microsoft® Visual Studio®. You should typically use
them for larger, more complex business intelligence (BI) solutions.

Tabular data models, however, consist of tables and relationships and use Data Analysis Expressions
(DAX). You can create them by using PowerPivot for Excel or Visual Studio. You should typically use
them for personal BI scenarios and larger BI solutions that do not require the advanced features of
multidimensional models.

Question: What extra functionality does a SQL Server 2012 Analysis Services tabular data model offer
over a PowerPivot for Excel tabular data model?

Answer: Row-level security, partitioning, and direct access mode.

Question: How can information workers use the PowerPivot workbooks that individuals upload to
PowerPivot Gallery?

Answer: They can open them in Windows® Internet Explorer®, open them in Microsoft
Excel®, and use them as data sources.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 109

Module 11
Introduction to DAX
Contents:
Lesson 1: DAX Fundamentals 110

Lesson 2: Using DAX to Create Calculated Columns and Measures in a


Tabular Data Model 112

Module Reviews and Takeaways 116


110 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 1
DAX Fundamentals
Contents:
Additional Reading 111
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 111

Additional Reading
DAX Syntax and Data Types
• Data Types Supported in PowerPivot Workbooks

DAX Queries
• DAX Table Queries
112 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 2
Using DAX to Create Calculated Columns and Measures in
a Tabular Data Model
Contents:
Detailed Demonstration Steps 113

Additional Reading 115


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 113

Detailed Demonstration Steps


Demonstration: Creating and Using Measures and Calculated Columns
Detailed demonstration steps
X Task 1: Create a calculated column
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. Then in the
D:\10778A\Demofiles\Mod11 folder, run Setup.cmd as Administrator.

2. In the D:\10778A\Demofiles\Mod11 folder, double-click the Demo.xlsx file to open it in Excel.

3. In the Demo workbook, on the ribbon, on the PowerPivot tab, click PowerPivot Window. The
PowerPivot window may open behind the workbook, so minimize the workbook so you can see it.

4. In the PowerPivot window, click the Geography tab.

5. In the Geography table, scroll across to the last column, double-click Add Column, type Full
Location Name, and then press Enter.

6. In the formula bar above the Geography table, type the DAX formula in the following code example,
and then press Enter.

=CONCATENATE([State or Province Name], CONCATENATE(", ",[Region Name]))

7. Right-click the State or Province Name column header, and then click Hide from Client Tools.

X Task 2: Create a measure


1. In the PowerPivot window, in the upper-left corner, click the Switch to Workbook button.

2. Click the Add Measure Demo tab, and then click PivotTable1.
3. In the PowerPivot Field list, click Refresh if notified that PowerPivot data was modified.

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

5. In the Measure Settings dialog box, in the Measure Name (all PivotTables) field, type Total Profit.
6. In the Formula field, type the DAX formula in the following code sample, and then click Check
Formula:

=SUM('Reseller Sales'[Sales Amount]) - SUM('Reseller Sales'[Total Product Cost])

7. In the Category field, click Currency, and then click OK.

X Task 3: Use measures in a PivotTable table and a PivotChart chart


1. When you create the Total Profit measure, it should automatically appear in the PivotTable1 table.
If it does not, in the PowerPivot Field List, expand Reseller Sales, and then select Total Profit.

2. In Reseller Sales, select Sales Amount.

3. Expand Product, drag Category to the Row Labels area, and then release it.
114 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

X Task 4: Use measures to create different groupings of data


1. Expand Date, drag Calendar Year to the Column Labels area, and then release it below Values. (This
groups the years inside each of the two measures.)

2. In the Column Labels area, click Calendar Year, and then click Move Up. (This groups the two
measures inside each of the years.)

3. In the Column Labels area, drag Values to the Row Labels area. (This nests the two measures inside
each category.)

4. Leave the Demo workbook open for the next Demonstration.

Demonstration: Using a Specific Relationship in a Measure


Detailed demonstration steps
X Task 1: Specify the relationship to use in a formula
1. In the Demo workbook, click the PowerPivot tab, and then on the PowerPivot ribbon, click
PowerPivot Window.

2. On the ribbon, in the View group, click the Diagram View button.
3. Use the mouse to point to each of the three lines between the Reseller Sales table and the Date
table, one at a time. The lines represent the relationships between the tables.

4. In the PowerPivot window, in the upper-left corner, click the Switch to Workbook button, click the
Multiple Relationships Demo tab, and then click anywhere in PivotTable1.

5. In the PowerPivot Field list, click Refresh if notified that PowerPivot data was modified.

6. In the PowerPivot Field List, expand Reseller Sales.

7. Right-click Sales With Ship Date, and then click Edit Formula.

8. In the Measure Settings dialog box, review the formula, and then click Cancel.

9. Drag Sales With Ship Date to the Values area in the PowerPivot Field List, and then release it.
10. In the PowerPivot Field List, expand Date, drag Calendar Year to the Row Labels area, and then
release it.

11. Close Demo.xlsx and do not save changes.


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 115

Additional Reading
Multiple Relationships
• USERELATIONSHIP function

Time Intelligence
• PowerPivot: DAX: Time Intelligence Functions
116 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Module Reviews and Takeaways


Review questions
Question: Do you or your colleagues use Excel formulas? What limitations have you encountered?
What features of DAX might help you to overcome these limitations?

Answer: Answers will vary depending upon individuals and their experiences.

Question: Do you have any table relationships for which the ability of DAX to support multiple
relationships might be useful?

Answer: Answers will vary depending upon individuals and their experiences. Suggest common
multiple relationship scenarios such as relationships that involve Date tables.

Question: Will time intelligence functionality be useful to you? What kinds of analyses might you
want to perform?

Answer: Answers will vary depending upon individuals and their experiences. Try to match
students’ suggestions to the relevant time intelligence functions.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 117

Module 12
Implementing a Tabular Data Model with Microsoft
PowerPivot
Contents:
Lesson 1: Introduction to Analysis Services Tabular Data Model Projects 118

Lesson 2: Developing an Analysis Services Tabular Data Model in SQL Server


Data Tools 122

Module Reviews and Takeaways 126


118 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 1
Introduction to Analysis Services Tabular Data Model
Projects
Contents:
Detailed Demonstration Steps 119

Additional Reading 121


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 119

Detailed Demonstration Steps


Demonstration: Creating a Tabular Data Model Project
Detailed demonstration steps
X Task 1: Create a tabular data model project
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. Then in the
D:\10778A\Demofiles\Mod12 folder, run Setup.cmd as Administrator.

2. Click Start, click All Programs, click Microsoft SQL Server 2012, and then click SQL Server SQL
Server Data Tools.

3. On the Start Page tab, click New Project.

4. In the New Project dialog box, in the Installed Templates pane, expand Business Intelligence, click
Analysis Services, and then click Import from PowerPivot.

5. In the Name box, type Sales, and then click Browse.

6. Click Browse, navigate to the D:\10778A\Demofiles\Mod12 folder, and then click Select Folder.
7. In the New Project dialog box, click OK. If the Workspace and Deployment Server Configuration
dialog box is displayed, in the Default Server list, select localhost\SQL2, and then click OK (this
dialog box is only displayed the first time you create a tabular model project).

8. In the Open dialog box, navigate to the D:\10778A\Demofiles\Mod12 folder, click Sales, and then
click Open. If a message notifies you that data cannot be imported, click yes to import the metadata.

9. Wait until the creation of the Sales project completes. Note that the data model in the project
includes a tab for each table in the model.

10. On the Tools menu, click Options, and in the Options dialog box, expand Analysis Services and
click Data Modeling. Note the name of the default workspace server used to host the data model
during development. Then click Cancel.

X Task 2: Configure a connection in a tabular data model project


1. On the Model menu, click Existing Connections, and then in the Existing Connections dialog box,
with the SqlServer MIA-SQLBI AdventureWorksDW connection selected, click Edit.

2. In the Edit Connection dialog box, click Impersonation. Then select Specific Windows user name
and password, enter ADVENTUREWORKS\ServiceAcct and Pa$$w0rd, and click OK.

3. In the Edit Connection dialog box, click Save. Then in the Existing Connections dialog box, with the
SqlServer MIA-SQLBI AdventureWorksDW connection selected, click Process to import the data.

4. When processing is complete, in the Data Processing dialog box click Close, and then in the
Existing Connections dialog box, Close. The model is now populated with data.

X Task 3: Edit a model in SQL Server Data Tools


1. In the Designer Window, click the Reseller Sales tab.

2. In the Measure Grid, click any empty cell, in the formula bar, type the expression in the code box
below, and then press Enter.
120 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Profit:=SUM('Reseller Sales'[SalesAmount]) - SUM('Reseller Sales'[TotalProductCost])

3. Note that the profit measure is calculated, and then on the File menu, click Save All.

4. Minimize SQL Server Data Tools. You will return to the project in a later demonstration.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 121

Additional Reading
What Is an Analysis Services Tabular Data Model?
• Determine the Server Mode of an Analysis Services Instance
122 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 2
Developing an Analysis Services Tabular Data Model in
SQL Server Data Tools
Contents:
Detailed Demonstration Steps 123

Additional Reading 125


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 123

Detailed Demonstration Steps


Demonstration: Deploying a Tabular Data Model
Detailed demonstration steps
X Task 1: Deploy a Tabular Data Model Project
1. Ensure that you have completed the previous demonstration in this module, and maximize SQL
Server Data Tools with the Sales project open.

2. On the Build menu, click Deploy Sales. If prompted, enter the user name
ADVENTUREWORKS\ServiceAcct and the password Pa$$w0rd and click OK.

3. In the Deploy dialog box, when deployment is complete, click Close. Then close SQL Server Data
Tools.

X Task 2: Add the BI Semantic Model Connection content type


1. Start Internet Explorer and browse to the SharePoint site at http://mia-sqlbi. Then on the Home
page, under Library, click PowerPivot Gallery.

2. On the SharePoint ribbon, in the Library Tools section, click Library.


3. In the Settings area, click Library Settings.

4. 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.

X Task 3: Create a BI Semantic Model Connection


1. On the Document Library Settings page, under Libraries, click PowerPivot Gallery.

2. On the SharePoint ribbon, in the Library Tools section, click Documents. Then in the New
Document drop-down list, click BI Semantic Model Connection.

3. In the New BI Semantic Model Connection page, in the File Name box, type Sales; in the
Description box, type Sales data model; in the Workbook URL or Server Name box, type
localhost\SQL2; in the Database (if connecting to a server) box, type Sales; and click OK. After a
few moments, the Sales connection is shown in the PowerPivot Gallery document library.

4. On PowerPivot Gallery page, click the Open New Excel Workbook icon for the Sales BI semantic
model connection.

5. When prompted, click Open. Then, when the download has completed, click Open again.

6. In Excel, in the Microsoft Excel Security Notice dialog box, click Enable.
124 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

7. In the PivotTable Field List pane, select Profit. Then in the Date table, select Calendar Year. Note
that the PivotTable shows profit by year.

8. Close Excel without saving any changes. Then close Internet Explorer.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 125

Additional Reading
Perspectives
• on security in tabular data models, see the Tabular Data Model Security topic in this module.
126 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Module Reviews and Takeaways


Review questions
Question: Why might you choose to create an Analysis Services tabular data model? Why might you
choose to create an Analysis Services Multidimensional Model?

Answer: You might create an Analysis Services Tabular Data Model to scale up an existing PowerPivot
for Excel workbook, enabling you to take advantage of the extra features such as row-level security
and partitioning. You may also choose to create this type of model because it enables you to take
advantage of in-house relational modelling skills to create a departmental or enterprise solution. You
might create an Analysis Services Multidimensional Model for solutions that are more complex, or
which require features, such as translations, that Tabular Data Models do not offer.

Question: How might you use partitions to manage the data that you have in your databases?

Answer: Answer will vary depending on the personal experiences of the students.

Question: What are the advantages of using DirectQuery mode? What features of tabular data
models are not supported in DirectQuery mode?

Answer: DirectQuery mode enables you to use a Tabular Data Model with very large data
sets for which in-memory processing would be impractical. DirectQuery mode does not
support row-level security, calculated columns, pasted or linked tables, or time intelligence
functions.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 127

Module 13
Creating Data Visualizations with Power View
Contents:
Lesson 1: Introduction to Power View 128

Lesson 2: Visualizing Data with Power View 130

Module Reviews and Takeaways 134


128 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 1
Introduction to Power View
Contents:
Detailed Demonstration Steps 129
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 129

Detailed Demonstration Steps


Demonstration: Modifying a Tabular Data Model to Support Power View
Reports
Detailed demonstration steps
X Task 1: Configure column properties
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. Then in the
D:\10778A\Demofiles\Mod13 folder, run Setup.cmd as Administrator.

2. In the D:\10778A\Demofiles\Mod13 folder, open the Sales Demo.sln solution.

3. In Solution Explorer, double-click Model.bim. Then click the Customer tab and note that the tables
in the model contain no data.
4. On the Model menu, click Process, and then click Process All. If prompted for impersonation
credentials, specify the user name ADVENTUREWORKS\ServiceAcct and the password Pa$$w0rd,
and then click OK. Wait until processing completes, and then in the Data Processing dialog box, click
Close.

5. On the Date tab, click the Month column and press F4. Then, in the Properties window, in the Sort
by Column drop-down list, select MonthNumberOfYear.

6. On the Product Category tab, click the Product Category column. Then, in the Properties window,
click Default Label, and then in the drop down list, click True.

X Task: 2 Create custom summaries


1. On the Reseller Sales tab, click the Order Quantity column. Then in the Properties window, click
Summarize By, and then in the drop down list, change the value to Sum.

2. On the Internet Sales tab, click the Order Quantity column. Then in the Properties window, click
Summarize By, and then in the drop down list, change the value to Sum.

X Task 3: Deploy the tabular data model project


1. On the File menu, click Save All

2. In Solution Explorer, right click Sales Demo and then click Deploy.

3. When deployment has completed, in the Deploy dialog box, click Close.

4. Close SQL Server Data Tools.


130 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 2
Visualizing Data with Power View
Contents:
Detailed Demonstration Steps 131
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 131

Detailed Demonstration Steps


Demonstration: Creating a Power View Report
Detailed demonstration steps
X Task 1: Create a BI Semantic Model Connection
1. Ensure that you have completed the previous demonstration in this module.

2. Start Internet Explorer and browse to the SharePoint site at http://mia-sqlbi. Then, on the
Adventure Works Portal - Home page, under Libraries, click PowerPivot Gallery.

3. On the SharePoint ribbon, in the Library Tools section, click Library.

4. In the Settings area, click Library Settings.


5. 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.

6. On the Document Library Settings page, under Libraries, click PowerPivot Gallery.
7. On the SharePoint ribbon, in the Library Tools section, click Documents. Then in the New
Document drop-down list, click BI Semantic Model Connection.

8. In the New BI Semantic Model Connection page, in the File Name box, type Sales Demo; in the
Description box, type Sales data model; in the Workbook URL or Server Name box, type
localhost\SQL2; in the Database (if connecting to a server) box, type Sales Demo; and click OK.
After a few moments, the Sales Demo connection is shown in the PowerPivot Gallery document
library.

X Task 2: Create a Power View report


1. On the PowerPivot Gallery page, to the right of Sales Demo, click the Create Power View Report
icon.

2. In the Power View window, in the fields pane, expand Internet Sales, and then select Internet Sales
Total.

3. On the ribbon, in the Table Tools group, on the Design tab, in the Visualizations area, click
Column.

4. Drag the lower-right corner of the chart and resize it to fill the available space.

5. In the fields pane, expand Date, and then select Calendar Year to add this column to the Axis Fields
field in the Layout Section.
132 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

6. Select Month to add this column to the Series field in the Layout Section.

7. In the chart, in the Month legend, click April. Note that the chart display changes to highlight the
month of April. Click April again to display all months.

8. In the fields pane, expand Geography, and then check Country Region to add this column to the
Vertical Multiples field in the Layout Section.

9. Click in a blank space in the main view area. Then, on the ribbon, on the Home tab, in the Filters
group, click Filters Area.

10. In the fields pane, expand Product Category, drag Product Category to the filters pane, and then
check the Bikes and Clothing check boxes. The report is filtered to show sales for only bikes and
clothing.

X Task 3: Add a view to a report


1. In the ribbon on the Home tab, in the Views group, in the New View drop-down list, click New
View.

2. In the fields pane, under Internet Sales, select Internet Profit; under Date, select Calendar Year,
expand Sales Territory, and select Country; and then in the Visualizations Gallery, click Line.

3. Resize the chart to fill the available space.

X Task 4: Save and export a report


1. On the File menu, click Save As, in the Save As dialog box, in the File name field, type Internet
Review, and then click Save.

2. On the File, click Export to PowerPoint, and when prompted, click Save. in the Save As dialog box,
browse to D:\10778A\Demofiles\Mod13, in the File name field, type Internet Review Presentation,
and then click Save.
3. Minimize Internet Explorer, and in the D:\10778A\Demofiles\Mod13 folder, double-click Internet
Review Presentation.pptx to view the exported presentation.

4. View the presentation as a slide show (if notified about a problem with the graphics adapter, click
OK), and then close PowerPoint without saving any changes.

Demonstration: Using a Play Axis in a Report


Detailed demonstration steps
X Task 1: Create a scatter chart with a play axis
1. Ensure that you have completed the previous demonstration.

2. In Internet Explorer, in the SharePoint site at http://mia-sqlbi, view the PowerPivot Gallery
document library, and to the right of Sales Demo, click the Create Power View Report icon.

3. In the fields pane, expand Reseller Sales, and click Reseller Sales Total.

4. Drag the lower-right corner of the table and resize it to fill the available space, and then on the
ribbon, in the Visualizations gallery, click Scatter.

5. In the fields pane, under Reseller Sales, click Total Product Cost to add this field to the Y Value box
in the Layout Section.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 133

6. In the Fields Section, in Reseller Sales, click Reseller Profit to add this field to the Size box in the
Layout Section.

7. In the fields pane, expand Product Subcategory, and click Product Subcategory to add this field to
the Details box in the Layout Section.

8. In the fields pane, expand Date, and drag Calendar Year to the Play Axis box in the Layout Section.

9. On the ribbon, on the Home tab, click Filters Area. Then, in the fields pane, under Product
Category, drag Product Category to the filters pane, and then check only the Bikes check box.

10. Click the scatter chart, and 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. The chart shows a time lapse that
demonstrates how the total cost and sales amount for bikes have both grown over the four year
period.

12. Close Internet Explorer. When prompted, click Leave this page.
134 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Module Reviews and Takeaways


Review questions
Question: What is the purpose of the Power View tool? How does if fit in with other reporting and
analysis tools?

Answer: Power View is an ad hoc data exploration tool, which you can use to create reports that have
a strong visual impact. It is designed for on screen use, where the user can easily change reports as
needed, as well as for creating interactive PowerPoint presentations.

Question: Why is it important to carefully design your tabular data models if you intend to use them
to support Power View reporting?

Answer: The tabular data model that supports a Power View report contains special properties that
enable use of representative images and columns in reports. You can also create custom summary
values in the model to include in the report.

Question: Can you think of any data sets in your workplace that you might explore by using Power
View?

Answer: Answer will vary depending on the personal experiences of the students.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 135

Module 14
Performing Predictive Analysis with Data Mining
Contents:
Lesson 1: Overview of Data Mining 136

Lesson 2: Creating a Data Mining Solution 139

Lesson 3: Validating a Data Mining Model 143

Lesson 4: Consuming Data Mining Data 147

Module Reviews and Takeaways 151


136 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Lesson 1
Overview of Data Mining
Contents:
Detailed Demonstration Steps 137

Additional Reading 138


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 137

Detailed Demonstration Steps


Demonstration: Performing Table Analysis in Excel
Detailed demonstration steps
X Task 1: Create a connection to Analysis Services
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. Then in the
D:\10778A\Demofiles\Mod14 folder, run Setup.cmd as Administrator.

2. In the D:\10778A\Demofiles\Mod14 folder, double-click Table Analysis.xlsx to open it in Excel.

3. On the ribbon, in the Table Tools group, click the Analyze tab, and then click <No Connection>.

4. In the Analysis Services Connections dialog box, click New, in the Connect to Analysis Services
dialog box, in the Server name field, type (local), in the Catalog name drop-down list, click
DMAddinsDB, and then click OK.
5. In the Analysis Services Connections dialog box, click Close.

X Task 2: Use the 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. Note the values that most strongly
correlate with a customer purchasing a bike.
6. Close Excel, and do not save changes to Table Analysis.xlsx.
138 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Additional Reading
Components of an Analysis Services Data Mining Solution
• Content Types (Data Mining)

Analysis Services Data Mining Algorithms


• Data Mining Algorithms (Analysis Services -Data Mining)

• Plugin Algorithms
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 139

Lesson 2
Creating a Data Mining Solution
Contents:
Detailed Demonstration Steps 140
140 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Using the Data Mining Wizard
Detailed demonstration steps
X Task 1: Create a data mining project in SQL Server Data Tools
1. Ensure that you have completed the previous demonstration.

2. Click Start, click All Programs, click Microsoft SQL Server 2012, and then click SQL Server Data
Tools.

3. In SQL Server Data Tools, on the File menu, click New, and click Project.

4. In the New Project dialog box, click Analysis Services Multidimensional and Data Mining Project,
in the Name field, type, Mine AW, in the Location field, browse to D:\10778A\Demofiles\Mod14,
and then click OK.

5. In Solution Explorer, right-click Data Sources, and then click New Data Source.
6. 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.

7. 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.

8. 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, click
Next, and then 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 and click vTargetMail (dbo), and click the > button to move the selected objects to
the Included objects list. Then click Next.

12. On the Completing the Wizard page, in the Name field, type AW DW View, and then click Finish.

X 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 the Create mining structure with
mining model radio button is selected, in the Which data mining technique do you want to use?
drop-down list, ensure that Microsoft Decision Trees is selected, and then click Next.

4. On the Select a Data Source View page, select AW DW View and click Next.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 141

5. On the Specify Table Types page, in the vTargetMail row, select the check box in the Case column,
and then click Next.

6. On the Specify the Training Data page, in the Mining Model Structure table, select the following
columns:

• BikeBuyer: Predictable

• CustomerKey: Key

• All other columns: Input

7. On the Specify Columns’ Content and Data Type page, click Detect and review the content type
and data types found. Ensure that the content type of the Bike Buyer column is identified as
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.
10. On the Build menu, click Deploy Mine AW.

11. Close SQL Server Data Tools

Demonstration: Modifying a Data Mining Structure


Detailed demonstration steps
X Task 1: Connect to a data mining model
1. Ensure that you have completed the previous demonstrations in this module.

2. Click Start, click All Programs, click Microsoft Office, and then click Microsoft Excel 2010.

3. On the ribbon, on the Data Mining tab, in the Connection area, click DMAddinsDM ((local)), and
then in the Analysis Services Connections dialog box, click New.

4. In the Connect to Analysis Services dialog box, in the Server name field, type (local), in the
Catalog name drop-down list, select Mine AW, and then click OK.
5. In the Analysis Services Connections dialog box, click Close.

X Task 2: Add a model to a 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, clear the Browse Model checkbox and click Finish.
142 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

6. On the ribbon, in the Management section, click Manage Models to verify that the model has been
added to the data mining structure, and then click Close.

7. Close Excel without saving the workbook.


Implementing Data Models and Reports with Microsoft® SQL Server® 2012 143

Lesson 3
Validating a Data Mining Model
Contents:
Detailed Demonstration Steps 144

Additional Reading 146


144 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Validating Data Mining Models
Detailed demonstration steps
X Task 1: Create a lift chart
1. Ensure that you have completed the previous demonstrations in this module.

2. Start SQL Server Management Studio, and when prompted, connect to the localhost instance of
Analysis Services by using Windows authentication.

3. In Object Explorer, expand Databases, expand Mine AW, and expand Mining Structures. Then
right-click the Purchase Prediction mining structure and click View Lift Chart.

4. On the Input Selection tab, note that both mining models are selected with the Bike Buyer column
as predictable, and that the test cases defined in the models themselves will be used for the
validation.
5. Click the Lift Chart tab, and view the lift chart, which compares accuracy for the two mining models
you have created against an ideal model by plotting the number of correct predications against the
number of cases in the overall sample. As the number of cases increases, the ideal model maintains an
accuracy of 100%, but the models you have created tend to become less accurate the more cases
there are.

6. Review the scores in the Mining Legend tab to see which of your models is the most accurate for this
test data.

X Task 2: Create a profit chart


1. In the Chart type drop-down list, select Profit Chart.

2. In the Profit Chart Settings dialog box, enter the following values to reflect a marketing campaign
you are planning, and then click OK:

• Population: 20000 (this is the number of potential customers you plan to contact)

• Fixed cost: 1000 (this is the fixed cost of you marketing campaign)
• Individual cost: 3 (this is the cost associated with contacting each customer)

• Revenue per individual: 10 (this is the amount you expect a customer to spend if they respond
positively to the campaign)
3. Review the chart and the Mining Legend tab to evaluate which mining model is likely to generate
the most profitable marketing campaign based on the test data.

X Task 3: Create a classification matrix


1. Click the Classification Matrix tab.

2. Review the matrix, noting that for each model it shows the number of times the model predicted a
Bike Buyer value of 0 or 1 on rows, with columns for the actual value of the Bike Buyer column in
the test data.

X Task 4: Create a cross validation report


1. Click the Cross Validation tab.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 145

2. Enter the following values, and click Get Results.

• Fold Count: 5 (this is the number of partitions used to group the data for analysis)

• Max Cases: 5 (this is the number of cases to be analyzed)

• Target Attribute: Bike Buyer (this is the predictable column to be evaluated)

• Target State: 1 (this is the desired value for the target attribute)

• Target Threshold: 0.1 (this is a value between 0 and 1 that indicates the level of accuracy
required for a prediction to be considered correct)

3. View the resulting report, and note that for each mining model, the results include the following:

• Classifications for true positives, false positives, true negatives, and false negatives.

• The likely lift gained by using the model.

4. Minimize SQL Server Management Studio – you will use it in the next demonstration.
146 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Additional Reading
Components of an Analysis Services Data Mining Solution
• Cross-Validation Formulas
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 147

Lesson 4
Consuming Data Mining Data
Contents:
Detailed Demonstration Steps 148

Additional Reading 150


148 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Detailed Demonstration Steps


Demonstration: Querying Data Mining Models
Detailed demonstration steps
X Task 1: Browse a data mining model
1. Ensure that you have completed the previous demonstrations in this module.

2. Maximize SQL Server Management Studio, and in Object Explorer, right-click the Purchase
Prediction data mining structure and click Browse.

3. In the Mining Model drop-down list, ensure that Purchase - Bayes is selected, and on the
Dependency Network tab, move the slider gradually from All Links to Strongest Links to see which
factors are the strongest predictors that a customer will purchase a bike.

4. On the Attribute Profiles tab, view the color-coded indicators of the values for each column when
compared to customers with a Bike Buyer value of 0 or 1.

5. On the Attribute Characteristics tab, in the Attribute drop-down list, ensure that Bike Buyer is
selected, and in the Value drop-down list, select 1. Then view the probability for each other column
value when the Bike Buyer value is 1.

6. On the Attribute Discrimination tab, in the Attribute drop-down list, ensure that Bike Buyer is
selected, in the Value drop-down list, select 1, and in the Value 2 drop-down list, select 0. Then note
how values for each other column favor a Bike Buyer value of 1 or 0.
7. In the Mining Model drop-down list, select Purchase Decision tree, and on the Decision Tree tab, in
the Background drop-down list, select 1. Then view the decision tree to see how the other column
values influence a value of 1 for Bike Buyer.

X Task 2: Query a data mining model


1. In Object Explorer, right-click the Purchase Prediction mining structure and click Build Prediction
Query.

2. 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.

3. In the Select Input Table(s) pane, click Select Case Table, in the Select Table dialog box, click
ProspectiveBuyer (dbo), and then click OK.
4. Under the Mining Model pane, in the Source column, click ProspectiveBuyer table, and then in the
Field column, click EmailAddress.

5. Under the row you just added, in the Source column, click Purchase – Bayes mining model, in the
Field column, click Bike Buyer, and in the Criteria/Argument column, type =1.

6. Under the row you just added, in the Source column, click Prediction Function, in the Field column,
click PredictProbability, in the Alias column, type Purchase Probability, and then drag the Bike
Buyer column from the Purchase – Bayes model in the Mining Model pane to the
Criteria/Argument column so that it contain the value [Purchase - Bayes].[Bike Buyer].

7. On the Mining Model menu, click Query to view the DMX code that has been generated.
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 149

8. On the Mining Model menu, click Result to view the query results. The query returns the email
address of every prospective customer who is predicted to buy a bike, along with the probability
(expressed as a percentage in fraction format) that the prediction is accurate.

9. Close SQL Server Management Studio without saving any changes.


150 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Additional Reading
Introduction to DMX
• Data Mining Extensions (DMX) Reference
Implementing Data Models and Reports with Microsoft® SQL Server® 2012 151

Module Reviews and Takeaways


Review questions
Question: What is the purpose of data mining?

Answer: The purpose of data mining is to reveal patterns and trends that cannot be discovered by
using standard analysis techniques.

Question: What are the major components of an Analysis Services data mining solution?

Answer: Data Mining Structure, Data Mining Model, case table.

Question: What are the main criteria for validating data mining models?

Answer: Accuracy, reliability, and usefulness.


152 Implementing Data Models and Reports with Microsoft® SQL Server® 2012

Send Us Your Feedback


You can search the Microsoft Knowledge Base for known issues at Microsoft Help and Support before
submitting feedback. Search using either the course number and revision, or the course title.

Note Not all training products will have a Knowledge Base article – if that is the case,
please ask your instructor whether or not there are existing error log entries.

Courseware Feedback
Send all courseware feedback to support@mscourseware.com. We truly appreciate your time and effort.
We review every e-mail received and forward the information on to the appropriate team. Unfortunately,
because of volume, we are unable to provide a response but we may use your feedback to improve your
future experience with Microsoft Learning products.

Reporting Errors
When providing feedback, include the training product name and number in the subject line of your e-
mail. When you provide comments or report bugs, please include the following:

10. Document or CD part number


1. Page number or location

2. Complete description of the error or suggested change

Please provide any details that are necessary to help us verify the issue.

Important All errors and suggestions are evaluated, but only those that are validated are
added to the product Knowledge Base article.

You might also like