10778AD-ENU-LabManual

257
OFFICIAL MICROSOFT LEARNING PRODUCT 10778A Lab Instructions and Lab Answer Key: Implementing Data Models and Reports with Microsoft® SQL Server® 2012

description

Manual

Transcript of 10778AD-ENU-LabManual

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

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

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

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

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

    2012 Microsoft Corporation. All rights reserved.

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

    Product Number: 10778A

    Part Number: X18-29140

    Released: 5/2012

  • Lab Instructions: Introduction to Business Intelligence and Data Modeling 1

    Module 1 Lab Instructions: Introduction to Business Intelligence and Data Modeling

    Contents: Exercise 1: Exploring a Reporting Services Report 2

    Exercise 2: Exploring a PowerPivot Workbook 4

    Exercise 3: Exploring a Power View Report 6

  • 2 Lab Instructions: Introduction to Business Intelligence and Data Modeling

    Lab: Reporting and Analyzing Data

    Exercise 1: Exploring a Reporting Services Report

    Scenario

    You want to explore the options for viewing reports in SQL Server 2012. To achieve this, you have installed SQL Server Reporting Services and Analysis Services in SharePoint Integrated mode, and a developer has created a Reporting Services report for you to explore.

    The main tasks for this exercise are as follows:

    1. Prepare the lab environment.

    2. Publish and view a Reporting Services report.

    Task 1: Prepare the lab environment Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIA-

    SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

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

    Task 2: Publish and view a Reporting Services report Start Internet Explorer and browse to the http://mia-sqlbi SharePoint site.

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

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

  • Lab Instructions: Introduction to Business Intelligence and Data Modeling 3

    In the Getting Started window, click Open. Then browse to the D:\10778A\Labfiles\Lab01\Starter\AWReports folder and open the Sales_Report.rdl report.

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

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

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

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

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

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

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

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

  • 4 Lab Instructions: Introduction to Business Intelligence and Data Modeling

    Exercise 2: Exploring a PowerPivot Workbook

    Scenario To help you to continue your exploration of reporting and data analysis options, a BI developer has created a PowerPivot workbook for you to review. You also intend to test PowerPivot Gallery by uploading the workbook.

    The main tasks for this exercise are as follows:

    1. Open and review a PowerPivot for Excel workbook.

    2. Upload a PowerPivot for Excel workbook to PowerPivot Gallery.

    3. Open a PowerPivot for Excel workbook from PowerPivot Gallery.

    Task 1: Open and review a PowerPivot for Excel workbook In the D:\10778A\Labfiles\Lab01\Starter folder, double-click AW Sales.xlsx.

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

  • Lab Instructions: Introduction to Business Intelligence and Data Modeling 5

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

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

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

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

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

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

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

    Task 2: Upload a PowerPivot for Excel workbook to PowerPivot Gallery Start Internet Explorer and browse to the http://mia-sqlbi SharePoint site.

    In the Libraries list, click PowerPivot Gallery.

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

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

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

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

    Task 3: Open a PowerPivot for Excel workbook from PowerPivot Gallery In the PowerPivot Gallery, click the large AW Sales icon.

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

    Clear the Calendar Year and Country slicer filters.

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

    Keep Internet Explorer open for the next exercise.

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

  • 6 Lab Instructions: Introduction to Business Intelligence and Data Modeling

    Exercise 3: Exploring a Power View Report

    Scenario Business users can find it useful to visualize data interactively. To explore this technique, you will use the tabular data model in the uploaded PowerPivot workbook to create a Power View report.

    The main task for this exercise is as follows:

    Open a Power View report and create a column chart.

    Task 1: Open a Power View report and create a column chart In the PowerPivot Gallery, to the right of AW Sales, click the Create Power View Report button (use

    the tooltips for the buttons to find this).

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

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

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

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

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

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

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

  • Lab Instructions: Implementing Reports with SQL Server Reporting Services 1

    Module 2 Lab Instructions: Implementing Reports with SQL Server Reporting Services

    Contents: Lab 2A: Creating a Report with Report Designer

    Exercise 1: Creating a Report 2

    Exercise 2: Grouping and Aggregating Data 5

    Lab 2B: Enhancing and Publishing a Report

    Exercise 1: Adding a Chart to a Report 9

    Exercise 2: Adding Parameters to a Report 12

    Exercise 3: Publishing a Report 14

    Optional Exercise: Using Data Bars and Sparklines 15

    Optional Exercise: Using a Map 18

  • 2 Lab Instructions: Implementing Reports with SQL Server Reporting Services

    Lab 2A: Creating a Report with Report Designer

    Exercise 1: Creating a Report

    Scenario

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

    The main tasks for this exercise are as follows:

    1. Prepare the lab environment.

    2. Create a Report Server project.

    3. Add a report to the project.

    4. Explore and modify report properties.

    5. Format the report.

    6. Export the report to Microsoft Excel

    Task 1: Prepare the lab environment Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIA-

    SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

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

  • Lab Instructions: Implementing Reports with SQL Server Reporting Services 3

    Task 2: Create a Report Server project Start SQL Server Data Tools and create a new Report Server project named AWReports in the

    D:\10778A\Labfiles\Lab02A\Starter\Ex1 folder.

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

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

    Use the following query to retrieve the data for the report (You can import this query from the D:\10778A\Labfiles\Lab02A\Starter\Ex1\SalesQuery.sql).

    SELECT d.CalendarYear [Year], d.MonthNumberOfYear [MonthNo], d.EnglishMonthName [Month], c.EnglishProductCategoryName [ProductCategory], s.EnglishProductSubcategoryName [ProductSubcategory], p.EnglishProductName [Product], i.SalesOrderNumber, i.OrderDate, i.SalesAmount FROM dbo.DimProductCategory c INNER JOIN dbo.DimProductSubcategory s ON s.ProductCategoryKey = c.ProductCategoryKey INNER JOIN dbo.DimProduct p ON p.ProductSubcategoryKey = s.ProductSubcategoryKey INNER JOIN dbo.FactInternetSales i ON i.ProductKey = p.ProductKey INNER JOIN dbo.DimDate d ON i.OrderDateKey = d.DateKey ORDER BY d.CalendarYear, d.MonthNumberOfYear, c.EnglishProductCategoryName, s.EnglishProductSubcategoryName, p.EnglishProductName, i.SalesOrderNumber

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

    Apply the generic report style.

    Name the report Sales Report.

    Task 4: Explore and modify report properties In the Report Data pane, change the name of the Dataset1 dataset to Sales.

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

    Task 5: Format the report Preview the report to view the default formatting.

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

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

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

  • 4 Lab Instructions: Implementing Reports with SQL Server Reporting Services

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

    Task 6: Export the report to Microsoft Excel Preview the report and export it to a Microsoft Excel workbook named Sales Report.xlsx in the

    D:\10778A\Labfiles\Lab02A\Starter\Ex1 folder.

    Open the exported report in Excel and view it.

    Close Excel and SQL Server Data Tools.

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

  • Lab Instructions: Implementing Reports with SQL Server Reporting Services 5

    Exercise 2: Grouping and Aggregating Data

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

    The main tasks for this exercise are as follows:

    1. Open the AWReports project.

    2. Delete the Year column and Titles row.

    3. Group the report by Month.

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

    5. Add aggregate summary values.

    6. Enable drilldown interactions.

    7. Add page breaks

    Task 1: Open the AWReports project Open the AWReports solution in the D:\10778A\Labfiles\Lab02A\Starter\Ex2 folder with SQL Server

    Data Tools.

    View the Sales Report report.

    Task 2: Delete the Year column and titles row Delete the Year column.

    Delete the row containing the column titles.

    Task 3: Group the report by Month Add a parent group to the SalesDetails group. The new group should group the data on the Month

    field and should include a group header.

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

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

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

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

    Preview the report again to ensure it looks correct.

  • 6 Lab Instructions: Implementing Reports with SQL Server Reporting Services

    Task 4: Add groups for Product Category, Product Subcategory, and Product Add parent groups with group headers to the SalesDetails group for the ProductCategory,

    ProductSubcategory, and Product fields.

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

    Ensure your report looks like the following image.

    Task 5: Add aggregate summary values Add totals rows before the SalesDetails, Product, ProductSubcategory, and ProductCategory

    groups.

    Add the following expression in the Product group heading row immediately above the SalesOrderNumber field:

    =Count(Fields!SalesOrderNumber.Value)

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

  • Lab Instructions: Implementing Reports with SQL Server Reporting Services 7

    Verify that your report looks like the following image.

    Task 6: Enable drilldown interactions Edit the visibility properties of the SalesDetails group so that it is hidden by default and its visibility

    can be toggled by the Product1 textbox (which is the textbox containing the Product value in the Product group heading.

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

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

  • 8 Lab Instructions: Implementing Reports with SQL Server Reporting Services

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

    Task 7: Add page breaks Set the InitialPageName property of the report to Sales Summary.

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

    Set the PageName property for the Month group to the following expression:

    =Fields!Month.Value

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

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

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

    Close Excel and SQL Server Data Tools.

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

  • Lab Instructions: Implementing Reports with SQL Server Reporting Services 9

    Lab 2B: Enhancing and Publishing a Report

    Exercise 1: Adding a Chart to a Report

    Scenario

    The sales manager at Adventure Works has requested that you add a chart to first page of the sales report. The chart should show sales volumes for each product category across months of the year.

    The main tasks for this exercise are as follows:

    1. Prepare the lab environment.

    2. Open the AWReports project.

    3. Add a Chart report item.

    4. Specify the data for the chart.

    5. Format the chart.

    Task 1: Prepare the lab environment Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIA-

    SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

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

    Task 2: Open the AWReports project Open the AWReports solution in the D:\10778A\Labfiles\Lab02B\Starter\Ex1 folder with SQL Server

    Data Tools.

    View the Sales Report report.

  • 10 Lab Instructions: Implementing Reports with SQL Server Reporting Services

    Task 3: Add a Chart report item Move the existing tablix data region down to make room for the chart.

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

    Task 4: Specify the data for the chart Configure the chart with the following data fields:

    Values: SalesAmount

    Category Groups: Month

    Series: ProductCategory

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

    Task 5: Format the chart Edit the chart properties and change the Color palette property to Semi transparent.

    Delete the chart title

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

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

  • Lab Instructions: Implementing Reports with SQL Server Reporting Services 11

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

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

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

  • 12 Lab Instructions: Implementing Reports with SQL Server Reporting Services

    Exercise 2: Adding Parameters to a Report

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

    The main tasks for this exercise are as follows:

    1. Open the AWReports project.

    2. Add a parameter.

    3. Configure available and default values for a parameter.

    Task 1: Open the AWReports project Open the AWReports solution in the D:\10778A\Labfiles\Lab02B\Starter\Ex2 folder with SQL Server

    Data Tools.

    View the Sales Report report.

    Task 2: Add a parameter In the Report Data pane, edit the query for the Sales dataset so that it matches the following

    Transact-SQL query. You can import this query from D:\10778A\Labfiles\Lab02B\Starter\Ex2\ Parameterized Sales Query.sql:

    SELECT d.CalendarYear [Year], d.MonthNumberOfYear [MonthNo], d.EnglishMonthName [Month], c.EnglishProductCategoryName [ProductCategory], s.EnglishProductSubcategoryName [ProductSubcategory], p.EnglishProductName [Product], i.SalesOrderNumber, i.OrderDate, i.SalesAmount FROM dbo.DimProductCategory c INNER JOIN dbo.DimProductSubcategory s ON s.ProductCategoryKey = c.ProductCategoryKey INNER JOIN dbo.DimProduct p ON p.ProductSubcategoryKey = s.ProductSubcategoryKey INNER JOIN dbo.FactInternetSales i ON i.ProductKey = p.ProductKey INNER JOIN dbo.DimDate d ON i.OrderDateKey = d.DateKey WHERE d.CalendarYear IN (@Year) ORDER BY d.CalendarYear, d.MonthNumberOfYear, c.EnglishProductCategoryName, s.EnglishProductSubcategoryName, p.EnglishProductName, i.SalesOrderNumber

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

    Edit the textbox containing the report title so that is contains the following expression:

    ="Sales Report for " & Join(Parameters!Year.Value, ", ")

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

  • Lab Instructions: Implementing Reports with SQL Server Reporting Services 13

    Task 3: Configure available and default values for a parameter In the Report Data pane, add a dataset named SalesYears. The data set should be embedded in the

    report and use the following query (which you can import from D:\10778A\Labfiles\Lab02B\Starter\Ex2\Sales Years.sql):

    SELECT DISTINCT YEAR(OrderDate) [Year] FROM FactInternetSales ORDER BY YEAR(OrderDate) DESC

    Add another embedded dataset named MaxYear that uses the following query (which you can import from D:\10778A\Labfiles\Lab02B\Starter\Ex2\Max Years.sql):

    SELECT YEAR(MAX(OrderDate)) [MaxYear] FROM FactInternetSales

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

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

    Close SQL Server Data Tools.

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

  • 14 Lab Instructions: Implementing Reports with SQL Server Reporting Services

    Exercise 3: Publishing a Report

    Scenario You have created a report for the sales manager, and must now deploy it to the report server, which is installed in SharePoint Integrated mode.

    The main tasks for this exercise are as follows:

    1. Open the AWReports project.

    2. Configure deployment properties.

    3. Deploy the AWReports project.

    Task 1: Open the AWReports project Open the AWReports solution in the D:\10778A\Labfiles\Lab02B\Starter\Ex3 folder with SQL Server

    Data Tools.

    View the Sales Report report.

    Task 2: Configure deployment properties Set the following properties for the AWReports project:

    OverwriteDatasets: True

    OverwriteDataSources: True

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

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

    TargetReportFolder: http://mia-sqlbi/Reports

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

    TargetServerURL: http://mia-sqlbi

    TargetServerVersion: SQL Server 2008 R2 or later

    Task 3: Deploy the AWReports project Deploy the project, and monitor the deployment status in the Output window.

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

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

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

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

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

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

  • Lab Instructions: Implementing Reports with SQL Server Reporting Services 15

    Optional Exercise: Using Data Bars and Sparklines

    Scenario The sales manager wants to be able to easily compare sales by product category. You must create a report that shows a visual comparison of total sales for the year and a comparison that shows the trend for sales of each category across the year.

    The main tasks for this exercise are as follows:

    1. Open the AWReports project.

    2. Add a data bar.

    3. Add a spark line.

    Task 1: Open the AWReports project Open the AWReports solution in the D:\10778A\Labfiles\Lab02B\Starter\Opt1 folder with SQL Server

    Data Tools.

    View the Sales Trends report.

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

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

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

    Fill style: Gradient

    Color: Light Steel Blue

    Secondary color: Cornflower Blue

    Gradient Style: Left right

  • 16 Lab Instructions: Implementing Reports with SQL Server Reporting Services

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

    Ensure that the data bar does not have a border.

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

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

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

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

    Fill style: Gradient

    Color: Light Steel Blue

    Secondary color: Cornflower Blue

    Gradient Style: Top bottom

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

    Ensure that the data bar does not have a border.

  • Lab Instructions: Implementing Reports with SQL Server Reporting Services 17

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

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

  • 18 Lab Instructions: Implementing Reports with SQL Server Reporting Services

    Optional Exercise: Using a Map

    Scenario You have created a report that lists sales totals for each US state. The sales manager has requested that the report show these sales values visually on a map.

    The main tasks for this exercise are as follows:

    1. Open the AWReports project.

    2. Add a map.

    3. Format the map.

    Task 1: Open the AWReports project Open the AWReports solution in the D:\10778A\Labfiles\Lab02B\Starter\Opt2 folder with SQL Server

    Data Tools.

    View the US Sales By State report.

    Task 2: Add a map Drag a Map item from the toolbox to the report body and complete the New Map Layer wizard

    using the following settings:

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

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

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

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

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

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

  • Lab Instructions: Implementing Reports with SQL Server Reporting Services 19

    Task 3: Format the map Click the map to display the Map Layers pane (you might need to scroll to the right to see the Map

    Layers pane as shown here), and modify the properties of the map as described below.

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

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

    Number of subranges: 10

    Range start: 0

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

    Change the map title to Sales by State.

    Remove the color scale at the bottom left.

  • 20 Lab Instructions: Implementing Reports with SQL Server Reporting Services

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

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

  • Lab Instruction: Supporting Self Service Reporting 1

    Module 3 Lab Instructions: Supporting Self Service Reporting

    Contents: Exercise 1: Using Report Builder 2

    Exercise 2: Simplifying Data Access for Business Users 5

    Exercise 3: Using Report Parts 7

  • 2 Lab Instruction: Supporting Self Service Reporting

    Lab: Implementing Self Service Reporting

    Exercise 1: Using Report Builder

    Scenario

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

    The main tasks for this exercise are as follows:

    1. Prepare the lab environment.

    2. Install Report Builder.

    3. Create a report.

    4. Format the report.

    5. Publish the report.

    Task 1: Prepare the lab environment Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIA-

    SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

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

  • Lab Instruction: Supporting Self Service Reporting 3

    Task 2: Install Report Builder Start Internet Explorer and browse to the SharePoint site at http://mia-sqlbi.

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

    Task 3: Create a report Use Report Builder to create a new report with the Table or Matrix Wizard. Use the following settings

    when creating your report:

    Create a dataset for the report and add a new SQL Server data source named AdventureWorksDW that uses the following connection string:

    Data source=localhost;Initial Catalog=AdventureWorksDW

    Use the query designer to create a query that retrieves the following fields, verifying the relationships that are detected by the query designer.

    DimProductCategory.EnglishProductCategoryName

    DimProductSubcategory.ProductCategoryKey

    DimProduct.ProductSubcategoryKey

    DimGeography.EnglishCountryRegionName

    DimGeography.StateProvinceName

    DimGeography.City

    DimReseller.GeographyKey

    FactResellerSales.ResellerKey

    FactResellerSales.SalesAmount

    Arrange the fields in the report as follows:

    Row groups

    EnglishCountryRegionName

    StateProvinceName

    City

    Column groups

    EnglishProductCategoryName

    Values

    SalesAmount

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

    Format the report using the Generic style.

  • 4 Lab Instruction: Supporting Self Service Reporting

    Task 4: Format the report Change the report title to Reseller Sales by Product Category.

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

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

    Task 5: Publish the report Save the report as Reseller Sales by Product Category.rdl in the http://mia-sqlbi/Reports folder.

    Then close Report Builder.

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

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

  • Lab Instruction: Supporting Self Service Reporting 5

    Exercise 2: Simplifying Data Access for Business Users

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

    The main tasks for this exercise are as follows:

    1. Create a shared data source.

    2. Create shared datasets.

    3. Create a report from shared data items.

    Task 1: Create a shared data source In Internet Explorer, in the Reports document library, on the Documents tab of the ribbon, in the

    New Document drop-down list, click Report Data Source. Then add a new data source with the following settings:

    Name: Adventure Works Data Warehouse

    Data Source Type: Microsoft SQL Server

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

    Credentials: Windows authentication (integrated) or SharePoint user

    Availability: Enable this data source selected

    Task 2: Create shared datasets In the Reports document library, on the Documents tab of the ribbon, in the New Document drop-

    down list, click Report Builder Report to start Report Builder.

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

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

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

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

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

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

  • 6 Lab Instruction: Supporting Self Service Reporting

    Task 3: Create a report from shared data items Use Report Builder to create a new report with the Table or Matrix Wizard. Use the following settings

    when creating your report:

    Use the Reseller Sales by Year.rsd dataset.

    Arrange the fields in the report as follows:

    Row groups

    CalendarYear

    Month

    Column groups

    ProductCategory

    Values

    SalesAmount

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

    Format the report using the Generic style.

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

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

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

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

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

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

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

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

  • Lab Instruction: Supporting Self Service Reporting 7

    Exercise 3: Using Report Parts

    Scenario You have identified a chart that business users frequently request in reports. You want to publish the chart as a report part to enable users to include it in their own reports.

    The main tasks for this exercise are as follows:

    1. Create a report part.

    2. Use a report part.

    Task 1: Create a report part In Report Builder, create a new report by using the Chart Wizard. Use the following settings when

    creating the report:

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

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

    Format the chart using the Generic style.

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

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

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

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

    Task 2: Use a report part In Report Builder, create a new blank report. Do not save the current report (from which you

    published the ResellerChart report part)

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

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

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

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

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

  • Lab Instructions: Managing Report Execution and Delivery 1

    Module 4 Lab Instructions: Managing Report Execution and Delivery

    Contents: Exercise 1: Configuring Report Execution 2

    Exercise 2: Implementing a Standard Subscription 4

    Exercise 3: Implementing a Data-Driven Subscription 5

  • 2 Lab Instructions: Managing Report Execution and Delivery

    Lab: Configuring Report Execution and Delivery

    Exercise 1: Configuring Report Execution

    Scenario

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

    The main tasks for this exercise are as follows:

    1. Prepare the lab environment.

    2. Deploy reports.

    3. Configure a shared data source.

    4. Configure a report.

    Task 1: Prepare the lab environment Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIA-

    SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

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

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

    Tools.

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

  • Lab Instructions: Managing Report Execution and Delivery 3

    Task 3: Configure a shared data source In the Reports document library in the http://mia-sqlbi SharePoint site, view the dependent items of

    the AdventureWorksDW data source and confirm that this data source is used by the Monthly Sales Report report.

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

    User Name: ADVENTUREWORKS\ServiceAcct

    Password: Pa$$w0rd

    Task 4: Configure a report In the Reports document library in the http://mia-sqlbi SharePoint site, manage the processing

    options for the Monthly Sales Report report, and configure it to use cached data. The cached report should expire on a custom schedule at midnight every day.

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

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

  • 4 Lab Instructions: Managing Report Execution and Delivery

    Exercise 2: Implementing a Standard Subscription

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

    The main tasks for this exercise are as follows:

    1. Subscribe to a report.

    2. Verify the subscription.

    Task 1: Subscribe to a report In the Reports document library in the http://mia-sqlbi SharePoint site, view the Monthly Sales

    Report report.

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

    Delivery Extension: E-Mail

    To: [email protected]

    Comment: The sales report is attached

    Show report inside message: Selected

    Format: Excel

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

    Parameters: Use report default value

    Task 2: Verify the subscription In the Reports document library in the http://mia-sqlbi SharePoint site, in the drop-down list for the

    Monthly Sales Report report, click Manage Subscriptions.

    View the information about the subscription you created in the previous task. Then wait for two minutes and refresh the page until the Last Results column indicates that mail was sent to [email protected].

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

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

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

  • Lab Instructions: Managing Report Execution and Delivery 5

    Exercise 3: Implementing a Data-Driven Subscription

    Scenario A number of business users want to receive the sales report by email. However, the users have expressed a preference for a variety of formats and subscription options. You have decided to use a data-driven subscription to deliver the report to these users.

    The main tasks for this exercise are as follows:

    1. Create a table of subscription data.

    2. Create a data-driven subscription.

    3. Verify the subscription.

    Task 1: Create a table of subscription data Use SQL Server Management Studio to open the Subscription Table.sql script file in the

    D:\10778A\Labfiles\Lab04\Starter folder. When prompted, use Windows authentication to connect to the database engine on the localhost server.

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

    SubscriptionID a unique primary key

    RecipientEmail the email address of a subscription recipient

    ReportFormat the format in which the report should be rendered.

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

    Execute the script and close SQL Server Management Studio.

    Task 2: Create a data-driven subscription In the Reports document library in the http://mia-sqlbi SharePoint site, in the drop-down list for the

    Monthly Sales Report report, click Manage Subscriptions.

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

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

    SELECT * FROM ReportSubscriptions

    Use the report default value for the CalendarYear parameter.

  • 6 Lab Instructions: Managing Report Execution and Delivery

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

    To: Select a value from the database (select RecipientEmail)

    Include Report: True

    Render Format: Select a value from the database (select ReportFormat)

    Subject: Specify a static value (enter Weekly sales report)

    Comment: Specify a static value (enter The weekly sales report is attached)

    Include Link: Select a value from the database (select Linked)

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

    Task 3: Verify the subscription In the Reports document library in the http://mia-sqlbi SharePoint site, in the drop-down list for the

    Monthly Sales Report report, click Manage Subscriptions.

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

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

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

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

  • Lab Instructions: Creating Multidimensional Databases 1

    Module 5 Lab Instructions: Creating Multidimensional Databases

    Contents: Exercise 1: Creating a Data Source 2

    Exercise 2: Creating and Modifying a Data Source View 4

    Exercise 3: Creating and Modifying a Cube 5

  • 2 Lab Instructions: Creating Multidimensional Databases

    Lab: Creating a Multidimensional Database

    Exercise 1: Creating a Data Source

    Scenario

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

    The main tasks for this exercise are as follows:

    1. Prepare the lab environment.

    2. Create a new SSAS project.

    3. Create a data source for the AdventureWorksDW relational database.

    Task 1: Prepare the lab environment Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIA-

    SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

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

    Task 2: Create a new SSAS project Use SQL Server Data Tools to create a new SSAS project.

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

  • Lab Instructions: Creating Multidimensional Databases 3

    Task 3: Create a data source for the AdventureWorksDW relational database Use the Data Source Wizard in SQL Server Data Tools.

    The AdventureWorksDW database is on the local server.

    Use Windows authentication to connect to the data source.

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

    Name the data source Adventure Works Data Warehouse.

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

  • 4 Lab Instructions: Creating Multidimensional Databases

    Exercise 2: Creating and Modifying a Data Source View

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

    The main tasks for this exercise are as follows:

    1. Create a data source view.

    2. Modify the data source view

    Task 1: Create a data source view Use the Data Source View Wizard in SQL Server Data Tools.

    Use the Adventure Works Data Warehouse data source.

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

    Name the data source view Adventure Works DSV.

    Task 2: Modify the data source view Use the Data Source View Designer in SQL Server Data Tools to:

    Change the FriendlyName property of FactInternetSales to InternetSales.

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

    Verify that the modified data source resembles the following image.

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

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

  • Lab Instructions: Creating Multidimensional Databases 5

    Exercise 3: Creating and Modifying a Cube

    Scenario Now that you have created a data source view, you are ready to create a cube that enables business users to perform multidimensional analysis on the data. You will then modify the cube to give the measures in the cube user-friendly names to make analysis simpler for your business users. You will also add additional attributes to dimensions to provide users with multiple ways to aggregate the measures.

    You need to modify the attributes of the dimension used for dates in your cube to ensure uniqueness across temporal periods. For example, the month of January is not unique because it occurs in every year, so you must modify the month attribute so that its key is based on both month and year, and then specify which of these key columns is to be used when displaying the attribute name.

    The main tasks for this exercise are as follows:

    1. Create a cube.

    2. Modify the cube.

    3. Modify dimensions.

    4. Modify attribute columns.

    5. Browse the cube.

    Task 1: Create a cube Use the Cube Wizard in SQL Server Data Tools to create a new cube.

    Build the cube by using existing tables.

    Have the Cube Wizard suggest measure group tables.

    Use all suggested dimensions other than Internet Sales.

    Name the cube Adventure Works Cube.

    Verify that the cube resembles the following image.

  • 6 Lab Instructions: Creating Multidimensional Databases

    Task 2: Modify the cube Change the name of the Unit Price Discount Pct measure to Unit Price Discount Percent.

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

    Task 3: Modify dimensions Modify the Customer dimension in Dimension Designer.

    Add the City, StateProvinceName, EnglishCountryRegionName, and SalesTerritoryKey attributes from the Geography table to the dimension.

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

    Verify that the modified dimension resembles the following image:

    Modify the Product dimension in Dimension Designer.

    Add the ProductAlternateKey, ProductSubcategoryKey, EnglishProductName, and ListPrice attributes from the Product table to the dimension.

  • Lab Instructions: Creating Multidimensional Databases 7

    Verify that the modified dimension resembles the following image:

    Modify the Date dimension in Dimension Designer.

    Add the EnglishDayNameOfWeek, EnglishMonthName, MonthNumberOfYear, CalendarQuarter, CalendarYear, and CalendarSemester attributes from the Date table to the dimension.

    Verify that the modified dimension resembles the following image:

  • 8 Lab Instructions: Creating Multidimensional Databases

    Task 4: Modify attribute columns In the dimension designer for the Date dimension, modify the Calendar Semester attribute so that a

    semester is uniquely identified by both the calendar year and the calendar semester, but displayed using only the calendar semester value:

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

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

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

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

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

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

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

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

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

    Task 5: Browse the cube Deploy the Adventure Works OLAP project, entering the user name ADVENTUREWORKS\Student

    and the password Pa$$w0rd if prompted. Then use Cube Browser to view the Adventure Works Cube cube.

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

  • Lab Instructions: Creating Multidimensional Databases 9

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

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

    You should select the Adventure Works OLAP database.

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

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

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

  • Lab Instructions: Working with Cubes and Dimensions 1

    Module 6 Lab Instructions: Working with Cubes and Dimensions

    Contents: Exercise 1: Configuring Dimensions 2

    Exercise 2: Defining Relationships and Hierarchies 4

    Exercise 3: Sorting and Grouping Dimension Attributes 10

  • 2 Lab Instructions: Working with Cubes and Dimensions

    Lab: Defining Dimensions

    Exercise 1: Configuring Dimensions

    Scenario

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

    The main tasks for this exercise are as follows:

    1. Prepare the lab environment.

    2. Remove unused attributes from dimensions.

    3. Add dimension intelligence.

    Task 1: Prepare the lab environment Ensure the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIA-

    SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

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

    Task 2: Remove unused attributes from dimensions Open the Adventure Works OLAP.sln solution in the D:\10778A\Labfiles\Lab06\Starter folder in SQL

    Server Data Tools.

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

  • Lab Instructions: Working with Cubes and Dimensions 3

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

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

    Task 3: Add dimension intelligence Use the Business Intelligence Wizard on the Date dimension to define dimension intelligence.

    Specify that the dimension is a Time dimension.

    Map the dimension attribute columns as follows:

    Attribute Type Dimension Attribute

    Year Calendar Year

    Half Year Calendar Semester

    Quarter Calendar Quarter

    Month Month

    Date Simple Date

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

  • 4 Lab Instructions: Working with Cubes and Dimensions

    Exercise 2: Defining Relationships and Hierarchies

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

    The main tasks for this exercise are as follows:

    1. Create attributes in the Date dimension.

    2. Create a natural hierarchy in the Date dimension.

    3. Create attribute relationships in the Customer dimension

    4. Create hierarchies in the Customer dimension.

    5. Create attribute relationships in the Product dimension.

    6. Create hierarchies in the Product dimension.

    7. Browse the hierarchies you have created.

    Task 1: Create attribute relationships in the Date dimension Open the Date dimension in Dimension Designer.

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

    Source Attribute Related Attribute Relationship Type

    Simple Date Month Rigid (will not change over time)

    Month Calendar Quarter Rigid (will not change over time)

    Calendar Quarter Calendar Semester Rigid (will not change over time)

    Calendar Semester Calendar Year Rigid (will not change over time)

  • Lab Instructions: Working with Cubes and Dimensions 5

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

    Task 2: Create a natural hierarchy in the Date dimension In the Dimension Structure for the Date dimension, create a hierarchy based on the relationships

    you created in the previous task:

    Drag the Calendar Year attribute to the Hierarchies pane.

    Add the following attributes to the indicator in the hierarchy in this order:

    Calendar Semester

    Calendar Quarter

    Month

    Simple Date

    Change the hierarchy name to Calendar Date.

    The completed hierarchy should resemble the following image.

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

  • 6 Lab Instructions: Working with Cubes and Dimensions

    Task 3: Create attribute relationships in the Customer dimension Open the Customer dimension in Dimension Designer.

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

    Source Attribute Related Attribute Relationship Type

    Postal Code City Flexible (may change over time)

    City State-Province Name Flexible (may change over time)

    State-Province Name English Country Region Name Flexible (may change over time)

    Marital Status Gender Flexible (may change over time)

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

    Task 4: Create hierarchies in the Customer dimension In the Dimension Structure for the Customer dimension, create a hierarchy based on the

    relationships you created in the previous task:

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

  • Lab Instructions: Working with Cubes and Dimensions 7

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

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

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

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

    Task 5: Create attribute relationships in the Product dimension Open the Product dimension in Dimension Designer.

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

    Source Attribute Related Attribute Relationship Type

    English Product Name English Product Subcategory Name Flexible (may change over time)

    English Product Subcategory Name English Product Category Name Flexible (may change over time)

  • 8 Lab Instructions: Working with Cubes and Dimensions

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

    Task 6: Create hierarchies in the Product dimension In the Dimension Structure for the Product dimension, create a hierarchy based on the relationships

    you created in the previous task:

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

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

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

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

  • Lab Instructions: Working with Cubes and Dimensions 9

    Task 7: Browse the hierarchies you have created Deploy the Adventure Works OLAP project, entering the user name ADVENTUREWORKS\Student

    and the password Pa$$w0rd if prompted.

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

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

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

  • 10 Lab Instructions: Working with Cubes and Dimensions

    Exercise 3: Sorting and Grouping Dimension Attributes

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

    The main tasks for this exercise are as follows:

    1. Modify the sort order of the Month attribute.

    2. Group the Yearly Income attribute hierarchy members.

    Task 1: Modify the sort order of the Month attribute Open the Date dimension in Dimension Designer, and browse Calendar Date hierarchy. Note that

    the month level is sorted in alphabetical rather than chronological order.

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

    AttributeHierarchyOptimizedState: NotOptimized

    AttributeHierarchyOrdered: False

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

    Source Attribute Related Attribute Relationship Type

    Month Month Number of Year Rigid (will not change over time)

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

    OrderBy: AttributeKey

    OrderByAttribute: Month Number Of Year

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

  • Lab Instructions: Working with Cubes and Dimensions 11

    Task 2: Group the Yearly Income attribute hierarchy members Open the Customer dimension in Dimension Designer, and browse Yearly Income hierarchy. Note

    that the salaries have no hierarchy, as shown in the following image.

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

    DiscretizationMethod: Automatic

    DiscretizationBucketCount: 5

    OrderBy: Key

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

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

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

  • Lab Instructions: Working with Measures and Measure Groups 1

    Module 7 Lab Instructions: Working with Measures and Measure Groups

    Contents: Exercise 1: Configuring Measures 2

    Exercise 2: Defining a Regular Relationship 6

    Exercise 3: Configuring Measure Group Storage 7

  • 2 Lab Instructions: Working with Measures and Measure Groups

    Lab: Configuring Measures and Measure Groups

    Exercise 1: Configuring Measures

    Scenario

    You are refining the OLAP cube for your company. Your users can currently view measures for Internet sales, but you have additional data for reseller sales in your data warehouse and they would like to analyze this data as well as Internet sales. When you add the reseller sales measures, your users have requested that you remove some measures that are not required for business analysis, and ensure that the measures in the cube are clearly named.

    In this exercise, you will configure format strings and display folders for measures.

    The main tasks for this exercise are as follows:

    1. Prepare the lab environment.

    2. Create a measure group.

    3. Modify measure groups.

    Task 1: Prepare the lab environment Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIA-

    SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

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

  • Lab Instructions: Working with Measures and Measure Groups 3

    Task 2: Create a measure group Use SQL Server Data Tools to open the Adventure Works OLAP.sln solution in the

    D:\Labfiles\Lab07\Starter folder.

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

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

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

  • 4 Lab Instructions: Working with Measures and Measure Groups

    Task 3: Modify measure groups Delete the following measures from the cube.

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

    Promotion Key

    Currency Key

    Sales Territory Key

    Revision Number

    Extended Amount

    Unit Price Discount Percent

    Discount Amount

    Product Standard Cost

    Freight

    Revision Number Fact Reseller Sales

    Extended Amount Fact Reseller Sales

    Unit Price Discount Pct

    Discount Amount Fact Reseller Sales

    Product Standard Cost Fact Reseller Sales

    Freight Fact Reseller Sales

    Rename the following measures:

    Measure Rename to:

    Order Quantity Order Quantity Internet Sales

    Unit Price Unit Price Internet Sales

    Total Product Cost Total Product Cost Internet Sales

    Sales Amount Sales Amount Internet Sales

    Tax Amount Tax Amount Internet Sales

    Order Quantity Fact Reseller Sales Order Quantity Reseller Sales

    Unit Price Fact Reseller Sales Unit Price Reseller Sales

    Total Product Cost Fact Reseller Sales Total Product Cost Reseller Sales

    Sales Amount Fact Reseller Sales Sales Amount Reseller Sales

    Tax Amt Tax Amount Reseller Sales

    Fact Reseller Sales Count Reseller Sales Count

  • Lab Instructions: Working with Measures and Measure Groups 5

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

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

  • 6 Lab Instructions: Working with Measures and Measure Groups

    Exercise 2: Defining a Regular Relationship

    Scenario Your users have specifically stated that they must be able to analyze reseller sales by product, so you must create the required relationships to support aggregating reseller sales measures by the Product dimension.

    In this exercise, you will create a regular relationship.

    The main task for this exercise is as follows:

    1. View existing dimensions for measure groups.

    2. Create a dimension.

    Task 1: View existing dimensions for measure groups Deploy the Adventure Works OLAP project, entering the user name ADVENTUREWORKS\Student

    and the password Pa$$w0rd if prompted.

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

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

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

    Task 2: Create a dimension On the Dimensions Usage tab of the cube designer for Adventure Works Cube, define a regular

    relationship at the intersection of the Reseller Sales measure group and the Product dimension.

    Define the relationship at the Product Key level of granularity.

    Select ProductKey as the measure group column.

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

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

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

  • Lab Instructions: Working with Measures and Measure Groups 7

    Exercise 3: Configuring Measure Group Storage

    Scenario Users have requested that the cube should be optimized to improve performance when analyzing Internet sales. However, you must balance this need for optimization against the space required to store aggregations.

    The main tasks for this exercise are as follows:

    1. Configure the storage mode of the Internet Sales measure group.

    2. Design aggregations for the Internet Sales measure group.

    Task 1: Configure the storage mode of the Internet Sales measure group Configure proactive caching for the Internet Sales measure group in the Adventure Works Cube

    cube.

    Specify that the Automatic MOLAP setting should be used.

    Task 2: Design aggregations for the Internet Sales measure group Use the Aggregation Design Wizard to design aggregations for the Internet Sales measure group in

    the Adventure Works Cube cube.

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

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

    Generate aggregations until the performance gain reaches 35%.

    Name the aggregation you have generated InternetSalesAgg.

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

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

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

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

  • Lab Instructions: Introduction to MDX 1

    Module 8 Lab Instructions: Introduction to MDX

    Contents: Exercise 1: Querying a Cube by Using MDX 2

    Exercise 2: Creating a Calculated Member 4

  • 2 Lab Instructions: Introduction to MDX

    Lab: Using MDX

    Exercise 1: Querying a Cube by Using MDX

    Scenario

    You are a BI developer for the Adventure Works Cycles company, and you are creating a custom analysis application for the Chief Finance Officer (CFO). The application must return sales data for products, customers, and dates from the Adventure Works Cube, so you have initially decided to experiment with MDX syntax to query the cube and retrieve business data.

    In this exercise, you will write multiple MDX queries to obtain the necessary information for the sales management team.

    The main tasks for this exercise are as follows:

    1. Prepare the lab environment.

    2. Deploy an OLAP database.

    3. Write simple MDX queries.

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

    Task 1: Prepare the lab environment Ensure that the MIA-DC1 and MIA-SQLBI virtual machines are both running, and then log on to MIA-

    SQLBI as ADVENTUREWORKS\Student with the password Pa$$w0rd.

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

  • Lab Instructions: Introduction to MDX 3

    Task 2: Deploy an OLAP database Use SQL Server Data Tools to open the Adventure Works OLAP.sln solution in the

    D:\10778A\Labfiles\Lab08\Starter folder. Then deploy the solution, entering the user name ADVENTUREWORKS\Student and the password Pa$$w0rd if prompted.

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

    Task 3: Write simple MDX queries In SQL Server Management Studio, connect to the localhost instance of Analysis Services, and then

    create and execute a new MDX query in the Adventure Works OLAP database that displays the Sales Amount Internet Sales measure for each product category.

    Use the following MDX code:

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

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

    Use the following MDX code:

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

    Task 4: Write an MDX query to return data on rows and columns In SQL Server Management Studio, create and execute an MDX query that returns the Sales Amount

    measure with calendar years from the Calendar Date hierarchy on columns and cities from the Customer Geography hierarchy on rows.

    Use the following MDX code:

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

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

  • 4 Lab Instructions: Introduction to MDX

    Exercise 2: Creating a Calcula