SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07...

18
SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Model in SQL Server 2014 Jump to the Lab Overview

Transcript of SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07...

Page 1: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

SQL Server 2014 BI

►Lab 07

Creating a Reporting Services

Report Based on a Tabular Data

Model in SQL Server 2014

Jump to the Lab Overview

Page 2: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 2

© Copyright 2014 Microsoft Corporation. All rights reserved.

Terms of Use

© 2014 Microsoft Corporation. All rights reserved.

Information in this document, including URL and other Internet Web site references, is subject to change

without notice. Unless otherwise noted, the 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.

For more information, see Microsoft Copyright Permissions at http://www.microsoft.com/permission

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 Microsoft company name and Microsoft products mentioned herein may be either registered

trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. The

names of actual companies and products mentioned herein may be the trademarks of their respective

owners.

This document reflects current views and assumptions as of the date of development and is subject

to change. Actual and future results and trends may differ materially from any forward-looking

statements. Microsoft assumes no responsibility for errors or omissions in the materials.

THIS DOCUMENT IS FOR INFORMATIONAL AND TRAINING PURPOSES ONLY AND IS PROVIDED

"AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING BUT

NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR

PURPOSE, AND NON-INFRINGEMENT.

Page 3: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 3

© Copyright 2014 Microsoft Corporation. All rights reserved.

Contents

TERMS OF USE ............................................................................................................................... 2

CONTENTS ..................................................................................................................................... 3

ABOUT THE AUTHOR .................................................................................................................... 4

DOCUMENT REVISIONS ................................................................................................................ 4

LAB OVERVIEW .............................................................................................................................. 5

EXERCISE 1: CREATING A REPORT USING THE MAP WIZARD ................................................. 6

Task 1 – Creating the Sales Analysis Shared Data Source ......................................................................................... 6

Task 2 – Creating a Report Builder Report ....................................................................................................................... 8

Task 3 – Configuring a Map Data Region......................................................................................................................... 9

Task 4 – Refining the Map Layout .................................................................................................................................... 13

Task 5 – Finishing Up ............................................................................................................................................................. 18

SUMMARY .................................................................................................................................... 18

Page 4: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 4

© Copyright 2014 Microsoft Corporation. All rights reserved.

About the Author

This lab was designed and written by Peter Myers.

Peter Myers has worked with Microsoft database and development products since

1997. Today, he specializes in all Microsoft BI products and provides mentoring,

technical training, and education content authoring for SQL Server, Office, and

SharePoint. Peter has a broad business background supported by a bachelor’s

degree in applied economics and accounting, and he extends this with solid experience backed

by current MCSE and MCT certifications. He has been a SQL Server MVP since 2007.

Document Revisions

# Date Author Comments

0 19-OCT-2014 Peter Myers Initial release

Page 5: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 5

© Copyright 2014 Microsoft Corporation. All rights reserved.

Lab Overview

Introduction

In this lab, you will author a report in Report Builder by using the Map Wizard, and based on the

AW Sales tabular database.

Objectives

The objectives of this exercise are to:

Create a Shared Data Source based on a tabular database

Create a Report Builder report that references the shared data source

Use the MDX graphical query designer to produce a dataset using the shared data

source

Exercises

This hands-on lab comprises the following exercise:

1. Creating a Report by Using the Map Wizard

Estimated time to complete this lab: 30 minutes

Page 6: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 6

© Copyright 2014 Microsoft Corporation. All rights reserved.

Exercise 1: Creating a Report Using the Map Wizard

In this exercise, you will create a report using the Map Wizard.

The finished report will resemble the following.

Figure 1

Previewing the US Sales by State Report

Task 1 – Creating the Sales Analysis Shared Data Source

In this task, you will create a report data source to connect to the AW Sales tabular database.

1. To open Internet Explorer, on the taskbar, click the Internet Explorer shortcut.

Figure 2

Selecting the Internet Explorer Shortcut

2. In the Internet Explorer favorites, select AdventureWorks BI Site.

Page 7: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 7

© Copyright 2014 Microsoft Corporation. All rights reserved.

3. In the Quick Launch (located at the left), select the Data Connections library.

Figure 3

Selecting the Data Connections Library

4. On the Files ribbon tab, from inside the New group, click the down arrow for New

Document, and then select Report Data Source.

Figure 4

Clicking the Down Arrow Below For Document

5. In the Name box, enter AW Sales.

6. In the Data Source Type dropdown list, select Microsoft SQL Server Analysis Services.

7. In the Connection String box, enter the following connection string.

Connection String

Data Source=localhost\TABULAR;Initial Catalog=AW Sales;

Note: For convenience, the connection string can be copied from the

D:\SQLServerBI\Lab07\Assets\Snippets.txt file.

Page 8: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 8

© Copyright 2014 Microsoft Corporation. All rights reserved.

8. Click Test Connection.

9. When the connection is created successfully, click OK (located at the bottom of the

page).

Task 2 – Creating a Report Builder Report

In this task, you will use the Map Wizard to create the report based on the Sales Analysis report

data source.

1. In the Quick Launch menu, select Reports.

2. On the Files ribbon tab, from inside the New group, click the down arrow for New

Document, and then select Report Builder Report.

3. When the Application Run – Security Warning window opens, click Run to authorize

the download and installation of Report Builder.

Note: If Report Builder has already been installed you will not receive this warning and

prompt.

4. When Report Builder opens, in the Getting Started window, click Blank Report.

Figure 5

Selecting Blank Report

5. If necessary, maximize the window.

Page 9: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 9

© Copyright 2014 Microsoft Corporation. All rights reserved.

6. To remove the default report title, in the report design pane, select the edge of the Click

to Add Title textbox, and then press the Delete key.

7. To remove the report footer, on the Insert ribbon tab, from inside the Header & Footer

group, click Footer, and then select Remove Footer.

Task 3 – Configuring a Map Data Region

In this task, you will configure a map data region that uses analytic data sourced from the AW

Sales report data source created in the first task.

1. To launch the Map Wizard, on the Insert ribbon tab, from inside the Data

Visualizations group, click Map, and then select Map Wizard.

2. In the New Map window, at the Choose a Source of Spatial Data step, notice that the

Map Gallery option is selected, then in the Map Gallery, select USA by State Inset, and

then click Next.

Figure 6

Selecting the USA by State Inset map gallery

3. At the Choose Spatial Data and Map View Options, click Next.

Page 10: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 10

© Copyright 2014 Microsoft Corporation. All rights reserved.

4. At the Choose Map Visualization step, select the Color Analytical Map option, and

then click Next.

Figure 7

Selecting the Color Analytical Map Visualization

5. At the Choose the Analytical Dataset step, notice the selected option to add a dataset,

and then click Next.

6. At the Choose a Connection to a Data Source step, click Browse.

7. In the Select Data Source window, double-click the Data Connections folder, select the

AW Sales.rsds report data source, and then click Open.

8. In the New Map window, click Next.

Page 11: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 11

© Copyright 2014 Microsoft Corporation. All rights reserved.

9. At the Design a Query step, in the Metadata pane, expand the Reseller dimension,

expand the Geography hierarchy, and then drag the State level to the query grid.

Figure 8

Adding the State Level to the Query Grid

10. To introduce measures to the query grid, in the Metadata pane, expand Measures,

expand ResellerSales, and then drag the Sales and Profit% measures into the query

grid, to the right of State.

Note: When you introduce measures into the query grid, the query is automatically

executed.

11. To filter the query result, in the filter pane (located above the query grid), in the

Dimension column, select the Date dimension.

12. In the Hierarchy column, select the Calendar hierarchy, and then in the Filter

Expression column, expand the All member, select the CY2013 member, and then click

OK.

13. Notice that the query result now displays the measures by state for calendar year 2013.

14. To expose the Calendar hierarchy as a report parameter, scroll right to the end of the

filter pane.

Page 12: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 12

© Copyright 2014 Microsoft Corporation. All rights reserved.

15. In the Parameters column, check the checkbox.

Figure 9

Exposing the Date Calendar Hierarchy as a Report Parameter

16. To filter the query result to return only states from the United States, add a second filter

based on the following. Do not expose this filter as a report parameter.

Figure 10

Exposing the Reseller Geography Hierarchy as a Report Parameter

17. Notice that the query result now displays the measures by the United States’ states for

calendar year 2013.

18. Click Next.

19. At the Specify the Match Fields for Spatial and Analytical Data step, check the

STATENAME spatial dataset field, then in the corresponding Analytical Dataset Fields

dropdown list, select the State field.

Note: This step relates the query result to the polygons (states) that make up the map.

Figure 11

Configuring the Relationship Between the Spatial and Analytical Data

Page 13: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 13

© Copyright 2014 Microsoft Corporation. All rights reserved.

20. Click Next.

21. At the Choose Color Theme and Data Visualization step, configure the following

properties.

Property Value

Theme Generic

Field to Visualize [Sum(Sales)]

Color Rule Light-Dark

22. Click Finish.

23. To preview the report, on the Home ribbon tab, click Run.

24. To save the report, click the Report Builder button (the round button located at the top

left corner), and then select Save.

25. In the Save as Report window, navigate to the Reports library.

26. In the Name box, replace the text with US Sales by State, and then click Save.

Task 4 – Refining the Map Layout

In this task, you will format the map report layout that will involve defining the map title and

legend title, removing the color and distance scales, and introducing a tooltip expression for

each polygon (US state) in the map.

1. To return to design mode, on the Run ribbon tab, click Design.

2. In the Report Data pane (located at the left), expand the Parameters folder.

3. Right-click the DateCalendar parameter, and then select Parameter Properties.

4. In the Report Parameter Properties window, uncheck the Allow Multiple Values

checkbox.

5. Click OK.

6. In the report canvas, right-click the Map Title text, and then select Title Properties.

Page 14: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 14

© Copyright 2014 Microsoft Corporation. All rights reserved.

7. In the Map Title Properties window, to the right of the Title Text box, click the function

button.

Figure 12

Clicking the Function Button

8. In the Expression window, in the expression box, remove the entire expression text.

9. In the Category list, select Built-in Fields.

10. To add the report name to the expression, in the Item list, double-click the

ReportName item.

11. Complete the expression to look like the following.

VB.NET

=Globals!ReportName & " " &

12. Position the cursor at the very end of the expression, and ensure there is a space after

the last ampersand (&).

13. In the Category list, select Parameters.

14. In the Values list, double-click the DateCalendar parameter.

15. Modify the expression by replacing the Value property with the Label property.

16. Verify that the completed expression looks like the following.

VB.NET

=Globals!ReportName & " " & Parameters!DateCalendar.Label

17. Click OK.

18. In the Map Title Properties window, click OK.

Page 15: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 15

© Copyright 2014 Microsoft Corporation. All rights reserved.

19. To rename the legend title, first select, and then right-click the Title text in the legend,

and then select Legend Title Properties.

Figure 13

Configuring the Legend Title Properties

20. In the Map Legend Title Properties window, in the Legend Title Text box, replace the

text with Sales, and then click OK.

21. To remove the color scale, select the scale, and then press the Delete key.

Figure 14

Selecting the Color Scale

22. To remove the distance scale, select the scale, and then press the Delete key.

23. To configure the polygon properties, click inside the map at least twice to open the Map

Layers window, which is located at the right of the report design (you may need to scroll

to the right to see it).

Page 16: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 16

© Copyright 2014 Microsoft Corporation. All rights reserved.

24. Right-click the polygon layer, and then select Polygon Properties.

Figure 15

Configuring the Polygon Properties

25. In the Map Polygon Properties window, to the right of the Tooltip dropdown list, click

the function button.

Page 17: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 17

© Copyright 2014 Microsoft Corporation. All rights reserved.

26. In the Expression window, enter the following expression.

Note: The expression required in the following step may be copied from the

D:\SQLServerBI\Lab07\Assets\Snippets.txt file.

VB.NET

=Fields!State.Value & vbCrLf & "Sales: " & FormatNumber(Fields!Sales.Value, 0)

& vbCrLf & "Profit: " & FormatPercent(Fields!Profit_.Value, 2)

Note: This expression concatenates the value of the State field with a carriage return

and line feed, and then concatenates this with the numeric formatted value of the Sales

field and the percent formatted value of the Profit_ field.

The Profit_ field is based on the Profit% measure. The percent character (%) is not

permitted in identifier names used by Reporting Services, and so the underscore

character is substituted in.

27. Click OK.

28. In the Map Polygon Properties window, click OK.

29. To preview the report, on the Home ribbon tab, click Run.

Page 18: SQL Server 2014 BI Lab 07 - sec.ch9.ms · Model in SQL Server 2014 SQL Server 2014 BI Lab 07 Creating a Reporting Services Report Based on a Tabular Data Jump to the Lab Overview

Page 18

© Copyright 2014 Microsoft Corporation. All rights reserved.

30. Hover over several shaded states to review the tooltip. In particular, notice that Texas

achieved sales of 2,421,662.

Figure 16

Reviewing the Texas Sales for CY2013

31. In the Calendar parameter dropdown list, select CY2012, and then click View Report.

32. Notice the different sales and profit statistics for Texas.

33. To save the report, click the Report Builder button, and the select Save.

Task 5 – Finishing Up

In this task, you will finish up by closing all applications.

1. Click the Report Builder button, and then click Exit Report Builder.

2. Close the Internet Explorer window.

Summary

In this lab, you create a Report Builder reports using the Map Wizard and based on a tabular

database.