Hands on Lab: Building Your First Multidimensional Report with SQL Server 2008 R2 Reporting

Total Page:16

File Type:pdf, Size:1020Kb

Hands on Lab: Building Your First Multidimensional Report with SQL Server 2008 R2 Reporting

Hands-On Lab Building Your First Multidimensional Report with SQL Server 2008 R2 Reporting Services 1.

2. 3. Lab version: 1.0.0 4. Last updated: 6/1/2018

5.

6.

7.

8. CONTENTS 9. Overview

10. This lab will explore authoring a report based on an Analysis Services cube.

Note: Before you start with this exercise you must ensure that your machine meets the system requirements detailed in the next section. Additionally, you must complete the setup steps described in the next section.

11.

Objectives 1. The objectives of this exercise are to: Create and configure a Reporting Services project

Create an Analysis Services shared data source

Create a parameterized dataset using the MDX Query Designer

Develop a table report

Configure indicators

System Requirements 1. You must have installed the following items to complete this lab: Microsoft SQL Server 2008 R2:

Database Engine

Analysis Services

Reporting Services (Native mode)

SQL Server Business Intelligence Development Studio

SQL Server AdventureWorks2008 R2 sample databases

AdventureWorksDW2008R2 Setup 1. All the requisites for this lab are verified using the Configuration Wizard. To make sure that everything is correctly configured, follow these steps.

2. Note: To perform the setup steps you need to run the scripts in a command window with administrator privileges.

3. 4. Launch the Configuration Wizard for this lab by double-clicking the Dependencies.dep file located under the Source\Setup folder of this lab. Install any pre-requisites that are missing (rescanning if necessary) and complete the wizard.

Cleanup There is no need to cleanup if you intend to continue the sequence of labs in this training kit. 1. To restore the original state of the AdventureWorksDW2008R2 SQL Server database and delete the Sales Analysis Analysis Services database, execute the Cleanup.cmd script located under the Setup folder in the Source folder of this lab.

Exercises 1. This Hands-On Lab comprises the following exercise: 2. Authoring the Sales Performance Report

1. Estimated time to complete this lab: 30 minutes. 2. Exercise 1: Authoring the Sales Performance Report

3. In this exercise, you will create a shared data source for the Sales Analysis Analysis Services database, and then use this data source to author a report. The report will prompt the user for a calendar quarter and sales group and will present a table of sales indicators by salespeople. 4. The finished report will resemble the following. 5.

6. Figure 1 7. Previewing the Salesperson Performance Report

8.

Task 1 – Opening the Report Server Project 1. In this task, you will open the Report Server project. 2. Open SQL Server Business Intelligence Development Studio from Start | All Programs | Microsoft SQL Server 2008 R2 | SQL Server Business Intelligence Development Studio. 3. To open the AdventureWorksBI solution, on the File menu, select Open | Project/Solution. 4. In the Open Project window, navigate to the Ex1- AuthoringTheSalesPerformanceReport\Begin folder located in the Source folder for this lab, select the AdventureWorksBI.sln file, and then click Open.

4.a. Note: This solution consists of all completed labs that precede this lab.

4.b. 5. In Solution Explorer, if necessary, collapse the Populate DW and Sales Analysis projects.

Task 2 – Configuring the Report Server Project 1. In this task, you will configure the TargetServerURL property as preparation for the deployment task later in this lab. 2. In Solution Explorer, right-click the Sales Reports project, and then select Properties. 3. In the Sales Reports Property Pages window, ensure the TargetServerURL property is set to http:///ReportServer, and then click OK.

3.a. Note: You will need to substitute for the name of the machine that hosts Reporting Services.

3.b.

Task 3 – Creating the Shared Data Source 1. In this task, you will create a shared data source for the Sales Analysis Analysis Services database. Recall that it is a best practice to create a single shared data source per database and then reference it in reports. 2. In Solution Explorer, in the Sales Reports project, right-click the Shared Data Sources folder, and then select Add New Data Source. 3. In the Shared Data Source Properties window, in the Name box, replace the text with SalesAnalysis. 4. In the Type dropdown list, select Microsoft SQL Server Analysis Services. 5. To construct the connection string, click Edit. 6. In the Connection Properties window, configure the connection properties based on the following, and then click OK.

6.a. Note: You will need to substitute for the name of the machine that hosts Analysis Services.

6.b.

Property Value

Server Name

Database Name Sales Analysis 7. 8. In the Shared Data Source Properties window, click OK. 9. To save the solution, on the File menu, select Save All.

Task 4 – Creating the Sales Performance Report 1. In this task, you will create a new report and set the report’s Description property. 2. In Solution Explorer, in the Sales Reports project, right-click the Reports folder, and then select Add | New Item. 3. In the Add New Item window, in the Templates pane, select Report. 4. In the Name box, replace the text with Salesperson Performance, and then click Add.

4.a. Note: The report is automatically opened in the report designer.

4.b. 5. To select the report, click anywhere inside the report designer, and then in the Properties window, set the Description property to Sales performance by salesperson and quarter.

5.a. Note: If the Properties window is not open, on the View menu, select Properties Window.

5.b. 6. To save the solution, on the File menu, select Save All.

Task 5 – Creating the Report Data Source 1. In this task, you will create a reference to the SalesAnalysis shared data source created in Task 3. 2. In the Report Data window (located on the left), right-click the Data Sources folder, and then select Add Data Source. 3. In the Data Source Properties window, in the Name box, replace the text with SalesAnalysis. 4. Select the Use Shared Data Source Reference option, and then in the corresponding dropdown list, select the SalesAnalysis shared data source. 5. Click OK. 5.a.

5.b. Figure 2 5.c. Creating the Report Data Source

5.d.

Task 6 – Creating the Report Dataset 1. In this task, you will create the main dataset used by the report and define the dataset query using the MDX Query Designer. You will also rename the fields to become more user friendly for the report author. 2. In the Report Data window, right-click the SalesAnalysis data source, and then select Add Dataset. 3. In the Dataset Properties window, in the Name box, replace the text with dsMain. 4. To create the query, click Query Designer. 5. Maximize the Query Designer window. 6. To introduce fields to the dataset, in the Metadata pane (located on the left), expand the Salesperson dimension, and then drag the Salesperson attribute hierarchy (not multi-level hierarchy) to the Drag Levels or Measures Here to Add to the Query zone of the query grid.

6.a. 6.b. Figure 3 6.c. Dragging the Salesperson Attribute Hierarchy

6.d. 7. In the Metadata pane, expand Measures, expand the Reseller Sales measure group folder, and then drag the Sales Variance measure to the query grid, and drop it to the right of the Salesperson column.

7.a. Note: Once a measure is introduced into the query grid, the designer’s default behavior is to automatically query the data source and display the results.

7.b. 8. In the Metadata pane, expand KPIs, and then drag the Sales Performance KPI to the query grid, and drop it to the right of the Sales Variance column.

8.a. Note: An Analysis Services KPI consists of four metrics: Value, Goal, Status and Trend. When you introduce a KPI into the query grid, all four metrics are added. They can be introduced individually if required.

8.b. 9. To filter the dataset, in the filter pane (above the query pane), configure the following filters. 9.a.

9.b. Figure 4 9.c. Filtering the Query Result and Defining Parameters

9.d. 10. To create report parameters, be sure the check the Parameter checkbox at the end of each filter row.

10.a. Note: The query designer will automatically create a report parameter and dataset for each parameterized filter.

10.b. 11. On the toolbar, click the Design Mode button.

11.a.

11.b. Figure 5 11.c. Switch to Design Mode

11.d. 12. Review the MDX created by the query designer.

12.a. Note: You can customize the MDX but it will no longer be possible to revert to graphical mode.

12.b. 13. To revert to graphical mode, click the Design Mode button again. 14. In the Query Designer window, click OK. 15. In the Dataset Properties window, select the Fields page. 15.a. 15.b. Figure 6 15.c. Selecting the Fields Page

15.d. 16. To rename the fields to simpler names, in the Field Name box for Sales_Variance box, replace the text with Variance. 17. Repeat the last step to rename the four Sales Performance KPI metric fields based on the following table.

Field Name New Field Name

Sales_Performance_Valu Sales e

Sales_Performance_Goal Quota

Sales_Performance_Stat Status us_

Sales_Performance_Tren Trend d 18. 19. Click OK.

Task 7 – Exploring the Hidden Datasets 1. In this task, you will explore the hidden datasets and report parameters created by the MDX Query Designer. You will also disable the multi value option for both report parameters. 2. In the Report Data window, right-click the Datasets folder, and then select Show Hidden Datasets. 3. In the Report Data window, right-click the DateCalendarQuarter dataset, and then select Dataset Properties. 4. In the Dataset Properties window, click Query Designer. 5. In the Query Designer window, on the toolbar, click Execute Query.

5.a.

5.b. Figure 7 5.c. Executing the Query

5.d. 6. Review the query result, and in particular note the ParameterLevel column, and then click Cancel. 7. Select the Fields page. 8. Click the function button at the right of the ParameterCaptionIndented field row.

8.a.

8.b. Figure 8 8.c. Clicking the Function Button

8.d. 9. In the Expression window, notice the expression that indents the ParameterCaption field value by three times the ParamterLevel field value. 9.a. Note: The Space function takes a single numeric parameter and produces a string of spaces of that length. It does this to produce a visual stepped list of parameter members.

9.b. 10. In the Expression window, click Cancel. 11. In the Dataset Properties window, click Cancel. 12. In the Report Data window, expand the Parameters folder, right-click the DateCalendarQuarter report parameter, and then select Parameter Properties. 13. In the Report Parameter Properties window, uncheck the Allow Multiple Values checkbox. 14. Select the Available Values page. 15. Review the configuration to source available values from the DateCalendarQuarter dataset, and that presents the ParameterCaptionIndented field as the label, and then click OK. 16. In the Report Data window, right-click the SalespersonGroup report parameter, and then select Parameter Properties. 17. In the Report Parameter Properties window, uncheck the Allow Multiple Values checkbox, and then click OK. 18. In the Report Data window, right-click the Datasets folder, and then select Show Hidden Datasets to hide them again. 19. To save the solution, on the File menu, select Save All.

Task 8 – Authoring the Report Header 1. In this task, you will introduce a report header. Inside the report header you will then add report title and a parameter description textbox, and an image. 2. In the report designer, right-click inside the report body (the white rectangle), and then select Insert | Page Header. 3. To add a report title, from the Toolbox, drag the Textbox into the top left corner of the page header. 4. Right-click the textbox, and then select Expression. 5. In the Expression window, in the Category list, select Built-in Fields, and then in the Item list, double-click ReportName.

5.a. Note: This expression will dynamically assign the catalogued report name to the textbox.

5.b. 6. Click OK. 7. Ensure that the textbox is selected, and then in the Properties window, configure the following.

7.a. Note: The following location size properties are in inches. If your environment is set to metric measurements, you will need to append in (for inches) to the end of the value.

7.b.

Property Value

BorderStyle | Bottom Solid

Font | FontSize 22

Location | Left 0

Location | Top 0

Size | Width 4

Size | Height 0.4 8. 9. To add a parameter description textbox, from the Toolbox, drag the Textbox into the left corner of the page header, directly beneath the title textbox. 10. To configure an expression, right-click inside the textbox, and then select Expression. 11. In the Expression window, complete the following expression and click OK.

11.a. Note: The expressions required in this step may be copied from the Assets\Snippets.txt file in the Source folder of this lab. 11.b. Be sure that the expression commences with only one equals sign (=).

11.c. 11.d. VB.NET 11.e. =Trim(Parameters!DateCalendarQuarter.Label) & " – " & Trim(Parameters!SalespersonGroup.Label)

11.f. Note: The Trim function is required to remove spaces from the beginning of the Label string as they are not desirable in the parameter description textbox.

11.g. 12. Ensure that the textbox is selected, and then in the Properties window, configure the following. Property Value

Location | Left 0

Location | Top 0.4

Size | Width 4 13. 14. To add the company logo into the page header, from the Toolbox, drag the Image and drop it to the right of the report title. 15. In the Image Properties window, click Import. 16. In the Open window, navigate to the Assets folder located in the Source folder for this lab, select the AdventureWorksLogo.jpg file, and then click Open. 17. In the Image Properties window, click OK. 18. Ensure that the image is selected, and then in the Properties window, configure the following.

Property Value

Location | Left 4.5

Location | Top 0

Size | Width 2

Size | Height 0.6 19. 20. The report header design should resemble the following.

20.a.

20.b. Figure 9 20.c. Reviewing the Report Header Design 20.d.

Task 9 – Configuring the Table Data Region 1. In this task, you will add a Table to the report body and configure it to display the salespeople on the rows, and the numeric fields on the columns. 2. From the Toolbox, drag the Table and drop it into the top left corner of the body of the report. 3. Ensure that the table is selected, and then in the Properties window, configure the following.

Property Value

Location | Left 0

Location | Top 0 4. 5. To introduce an additional column, click anywhere inside the table, right-click the third column guide, and then select Insert Column | Right.

5.a.

5.b. Figure 10 5.c. Inserting a Column

5.d. 6. To assign dataset fields to the data row, hover over the first textbox in the Data row, click the Field List icon, and then select SalesAnalysis | dsMain | Salesperson.

6.a. 6.b. Figure 11 6.c. Clicking the Field List Icon 6.d. 7. Repeat the last step to introduce the Sales, Quota and Variance fields also. 8. Verify that your table design looks like the following.

8.a. 8.b. Figure 12 8.c. Verifying the Table Design

8.d. 9. To format the column widths, select the first column guide, and then in the Properties window, modify the Size |Width property to 1.8.

9.a. 9.b. Figure 13 9.c. Selecting the Column Guide

9.d. 10. To format the header row, select the first row guide, and then in the Properties window, configure the following.

10.a. 10.b. Figure 14 10.c. Selecting the Row Guide

10.d.

Property Value

BackgroundColor LightGrey

Font | Weight Bold 11. 12. To right align the text in the Sales column, select the second column guide, and then in the Properties window, modify the TextAlign property to Right. 13. To align the remaining numeric columns, repeat the last step for the third and fourth columns.

Task 10 – Leveraging the Extended Field Properties 1. In this task, you will modify the textbox properties to display the FormattedValue of each numeric field. Also, to apply the cube cell colors to the report data, you will assign the Color property of the Variance field textbox’s Color property. 2. To format the Sales values, right-click the [Sales] textbox, and then select Expression. 3. In the Expression window, in the Expression box, replace the Value field with the FormattedValue field. 4. Verify that the modified expression looks like the following. 4.a. Visual Basic 4.b. =Fields!Sales.FormattedValue

4.c.

4.d. Note: The Analysis Services data provider delivers extended field properties that have been designed to use in expressions.

4.e. 5. Click OK. 6. Repeat the last two steps to format the [Quota] and [Variance] field values. 7. To apply conditional color formatting to the Variance field values, select the [Variance.FormattedValue] textbox, and then in the Properties window, in the Color property, select Expression. 7.a. 7.b. Figure 15 7.c. Defining a Color Expression

7.d. 8. In the Expression window, in the Expression box, remove the entire text. 9. In the Category list, select Fields (dsMain). 10. To introduce a field into the expression, in the Values list, double-click the Variance field. 11. In the Expression box, replace the Value property with Color. 12. Verify that the modified expression looks like the following. 12.a. Visual Basic 12.b. =Fields!Variance.Color

12.c. 13. In the Expression window, click OK. 14. Verify that your table design looks like the following. 14.a. 14.b. Figure 16 14.c. Verifying the Table Design

14.d.

Task 11 – Introducing the Indicators 1. In this task, you will add two Indicator report items to graphically represent the Sales Performance KPI Status and Trend. 2. To introduce the Status indicator, click anywhere inside the table, right-click the last column guide, and then select Insert Column | Right. 3. To add a title for the new column, click inside the header textbox twice, and then type Status. 4. To format the Status column width, select the column guide, and then in the Properties window, modify the Size |Width property to 0.6. 5. Select the Status header textbox, and then in the Properties window, set the TextAlign property to Center. 6. From the Toolbox, drag the Indicator and drop it into textbox directly beneath the Status header textbox.

6.a. 6.b. Figure 17 6.c. Adding the Indicator

6.d. 7. In the Select Indicator Type window, in the Shapes group, select the 3 Signs indicator type, and then click OK.

7.a. 7.b. Figure 18 7.c. Selecting the 3 Signs Indicator Type

7.d. 8. Right-click the Indicator, and then select Indicator Properties. 9. In the Indicator Properties window, select the Value and States page. 10. In the Value dropdown list, select [Sum(Status)]. 11. In the States Measurement Unit dropdown list, select Numeric. 12. In the Indicator States list, for the Red state, in the Start box, replace the number with -1, and in the End box, remove the number (select the number and press Delete). 13. Repeat the last step for the remaining two indicator states based on the following table.

Indicator State Start End

Yellow 0 (Empty)

Green 1 (Empty) 14. 15. Use the arrow buttons to sequence the indicator states Green, Yellow and Red.

15.a. 15.b. Figure 19 15.c. Configuring the Status Indicator States

15.d. 16. Click OK. 17. To introduce the Trend indicator, right-click the last column guide, and then select Insert Column | Right. 18. To add a title for the new column, click inside the header textbox twice, and then type Trend. 19. To format the Trend column width, select the column guide, and then in the Properties window, modify the Size |Width property to 0.6. 20. From the Toolbox, drag the Indicator and drop it into textbox directly beneath the Trend header textbox. 21. In the Select Indicator Type window, in the Directional group, select the 3 Arrows (Colored) indicator type, and then click OK.

21.a. 21.b. Figure 20 21.c. Selecting the 3 Arrows (Colored) Indicator Type

21.d. 22. Right-click the Indicator, and then select Indicator Properties. 23. In the Indicator Properties window, select the Value and States page. 24. In the Value dropdown list, select [Sum(Trend)]. 25. In the States Measurement Unit dropdown list, select Numeric. 26. In the Indicator States list, configure the indicator states as follows.

26.a. 26.b. Figure 21 26.c. Configuring the Trend Indicator States

26.d. 27. Click OK.

Task 12 – Previewing the Report 1. In this task, you will preview the report. 2. In the report designer, select the Preview tab. 3. Review the report layout and data. 4. Notice the red values when the variance is negative.

Task 13 – Deploying the Report Server Project 1. In this task, you will deploy the project, consisting of the shared data source and three reports, to the Report Server. 2. In Solution Explorer, right-click the Sales Reports project, and then select Deploy. 3. When deployment completes (note the status line at the bottom of the window), review the feedback in the Output window.

Task 14 – Finishing Up 1. In this task, you will finish up by closing all applications. 2. On the File menu, select Exit. Summary

1. In this lab, you have developed and deployed a shared data source and reports based on an Analysis Services cube.

Recommended publications