48
Mastering OLAP Reporting: Reporting with Analysis Services KPIs By William Pearson About the Series ... This article is a member of the series MSSQL Server Reporting Services. The series is designed to introduce MSSQL Server Reporting Services ("Reporting Services"), with the objective of presenting an overview of its features, together with tips and techniques for real-world use. For more information on the series, please see my initial Database Journal article, A New Paradigm for Enterprise Reporting . As I have stated since the charter article of the series, published about the time Reporting Services was first publicly released, my conviction is that Reporting Services will commoditize business intelligence, particularly in its role as a presentation component within an integrated Microsoft BI solution. Having been impressed from my first exposure to this exciting application, when it was in early beta, my certainty in its destiny grows stronger by the day, as I convert formerly dominant enterprise business intelligence systems, such as Cognos, Business Objects / Crystal, MicroStrategy, Hyperion, and others, to the Reporting Services architecture. I receive constant requests to conduct strategy sessions about these conversions with large organizations in a diverse range of industries – the interest grows daily as awareness of the solution becomes pervasive. Indeed, the five- to six-plus figures that many can shave from their annual IT budgets represent a compelling sweetener to examining this incredible toolset. Note: To follow along with the steps we undertake within the articles of this series, the following components, samples and tools are recommended, and should be installed / accessible, according to the respective documentation that accompanies MSSQL Server 2005: Server Requirements Microsoft SQL Server 2005 Reporting Services Microsoft SQL Server 2005 Database Services The AdventureWorks sample databases Microsoft SQL Server 2005 Analysis Services The AdventureWorks OLAP cube Client Requirements Microsoft Internet Explorer 6.0 with scripting enabled Business Intelligence Development Studio (optional) Sample Files For purposes of the practice exercises within this series, we will be working with samples that are provided with MSSQL Server 2005. The samples with which we are concerned include, predominantly, the Adventure Works DW database. This database and

Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Embed Size (px)

Citation preview

Page 1: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Mastering OLAP Reporting: Reporting with Analysis Services KPIsBy William Pearson

About the Series ...

This article is a member of the series MSSQL Server Reporting Services. The series is designed to introduce MSSQL Server Reporting Services ("Reporting Services"), with the objective of presenting an overview of its features, together with tips and techniques for real-world use. For more information on the series, please see my initial Database Journal article, A New Paradigm for Enterprise Reporting.

As I have stated since the charter article of the series, published about the time Reporting Services was first publicly released, my conviction is that Reporting Services will commoditize business intelligence, particularly in its role as a presentation component within an integrated Microsoft BI solution. Having been impressed from my first exposure to this exciting application, when it was in early beta, my certainty in its destiny grows stronger by the day, as I convert formerly dominant enterprise business intelligence systems, such as Cognos, Business Objects / Crystal, MicroStrategy, Hyperion, and others, to the Reporting Services architecture. I receive constant requests to conduct strategy sessions about these conversions with large organizations in a diverse range of industries – the interest grows daily as awareness of the solution becomes pervasive. Indeed, the five- to six-plus figures that many can shave from their annual IT budgets represent a compelling sweetener to examining this incredible toolset.

Note: To follow along with the steps we undertake within the articles of this series, the following components, samples and tools are recommended, and should be installed / accessible, according to the respective documentation that accompanies MSSQL Server 2005:

Server Requirements

Microsoft SQL Server 2005 Reporting Services Microsoft SQL Server 2005 Database Services

The AdventureWorks sample databases

Microsoft SQL Server 2005 Analysis Services

The AdventureWorks OLAP cube

Client Requirements

Microsoft Internet Explorer 6.0 with scripting enabled Business Intelligence Development Studio (optional)

Sample Files

For purposes of the practice exercises within this series, we will be working with samples that are provided with MSSQL Server 2005. The samples with which we are concerned include, predominantly, the Adventure Works DW database. This database and companion samples are not installed by default in MSSQL Server 2005. The samples can be installed during Setup, or at any time after MSSQL Server has been installed.

The topics "Running Setup to Install AdventureWorks Sample Databases and Samples" in SQL Server Setup Help or "Installing AdventureWorks Sample Databases and Samples" in the Books Online (both of which are included on the installation CD(s), and are available from www.Microsoft.com and other sources, as well), provide guidance on samples installation. Important information regarding the rights / privileges required to accomplish samples installation, as well as to access the samples once installed, is included in these references.

Page 2: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Note: Current Service Pack updates are assumed for the operating system, along with the applications and components listed above and the related Books Online and Samples. Images are from a Windows 2003 Server environment, but the steps performed in the articles, together with the views that result, will be quite similar within any environment that supports MSSQL Server 2005 and its component applications.

About the Mastering OLAP Reporting Articles ...

One of the first things that become clear to "early adopters" of Reporting Services is that the "knowledgebase" for OLAP reporting with this tool is, to say the least, sparse. As I stated in my article, Mastering OLAP Reporting: Cascading Prompts, the purpose of the Mastering OLAP Reporting subset of my Reporting Services series is to focus on techniques for using Reporting Services for OLAP reporting. In many cases, which I try to outline in my articles at appropriate junctures, the functionality of well-established, but expensive, solutions, such as Cognos PowerPlay, can be met in most respects by Reporting Services – at a tiny fraction of the cost.

The vacuum of documentation in this arena, to date, represents a serious "undersell" of Reporting Services, from an OLAP reporting perspective. I hope to contribute to making this arena more accessible to everyone, and to share my implementation and conversion experiences as the series evolves. In the meantime, rest assured that the OLAP potential in Reporting Services will be yet another reason that the application commoditizes business intelligence.

For more information about the Mastering OLAP Reporting articles, see the section entitled "About the Mastering OLAP Reporting Articles" in my article Ad Hoc TopCount and BottomCount Parameters.

Overview

Among the many powerful new features that appear within MSSQL Server 2005 Analysis Services ("Analysis Services"), Key Performance Indicators ("KPIs") are yet another of the "gap closers" between the Microsoft integrated business intelligence solution (consisting of MSSQL Server Database Engine, Analysis Services, Integration Services, and Reporting Services) and the formerly dominant enterprise BI suites (such as Cognos, BO, MicroStrategy, etc.). As we shall see, we are not limited to using KPIs within Analysis Services, and can thus enjoy even more flexibility with these highly customizable components.

NOTE: For detailed information about Analysis Services 2005 KPIs, see my introductory article Mastering Enterprise BI: Introduction to Key Performance Indicators, a part of the Introduction to MSSQL Server Analysis Services series at Database Journal.

In this article, we will focus largely upon the use of Analysis Services KPIs within Reporting Services. We will discuss the general use of KPIs, and then move directly into preparing a scenario within which we use KPIs that exist in an Analysis Services cube, presenting them within a report we create within Reporting Services. As a part of our examination of the steps involved in making KPIs work within Reporting Services, we will:

Create a new Analysis Services Project within a Business Intelligence Development Studio solution;

Ascertain Connectivity of the Relational Data Source within the Analysis Services Project; Deploy the Analysis Services Project; Add a new Reporting Services Project to the solution; Ascertain Connectivity of the Analysis Services Shared Data Source; Modify a sample OLAP Report to work with our Cube; Add KPI Values to the Report; Drive Graphical Indicators with KPI Values in the report; Discuss, at appropriate junctures, the results obtained within the development techniques that

we exploit throughout our practice session.

Page 3: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Reporting with Analysis Services KPIs

Objective and Business Scenario

A Key Performance Indicator ("KPI") is a performance measure that specifies an emphasis intended to produce a desired result. As quantifiable measurements that gauge business success, KPIs can be diverse in nature, but they typically represent values, statuses, trends, or goals. KPIs often combine two or more of these into a single indicator. Because their purpose is to present high level, summary information to executives or other managers of the enterprise, who then use the information to steer an integrated organization, we typically limit the number of these vital measures to only a few.

KPIs are usually graphic in nature, and are collected into a dashboard, scorecard, or other central point of reference, where they can be easily accessed by the management team, to obtain a quick and accurate summary of business success or progress toward success. KPIs make it possible for management to make decisions and take action. Based upon the information the indicators convey, managers can pull the processes and activities that the KPIs represent into alignment with strategic goals and objectives.

KPIs can range from simple to complex, and they are often evaluated over time. A simple KPI (represented, say, by a smiling or frowning "Smiley" face image) might indicate a status of monthly employee turnover or headcount, either of which might represent a single, but important, key measure. A more complex KPI might combine multiple perspectives (a status, with regard to corporate market share for a given product, coupled with a trend, such as competitor market share over the past few months for a similar product) into a single graphic (say a directional arrow or a traffic signal), indicating that the enterprise is leading in share, that share is eroding, or even that it has been overtaken by its competition. KPIs can be used alone or in combination to support rapid management decisions and actions, and to provide an indication of progress toward the accomplishment of intended strategic outcomes.

Because the graphical output of Analysis Services KPIs can be directly consumed only from the KPI Browser in Analysis Services, one is initially challenged with the apparent fact that they are of limited use in external applications, among which reporting applications figure considerably. In this article, we will demonstrate not only a means of reporting upon the various values contained within Analysis Services KPIs, but we will also provide a flexible means for generating graphics that reflect KPI values in Reporting Services, with a result that resembles closely the presentation afforded in the Analysis Services KPI Browser.

Hands-On Procedure

We will begin by creating a new Report Server Project, within the SQL Server Business Intelligence Development Studio, wherein we will establish a Data Source pointed to a database sample provided with MSSQL Server 2005. This way, anyone with access to the installed application set and its samples can complete the steps in the practice session.

NOTE: For more exposure to the MSSQL Server Business Intelligence Development Studio itself, and the myriad design, development and other evolutions we can perform within this powerful interface, see other articles in this series, as well as in another of my Database Journal series, Introduction to MSSQL Server Analysis Services. In this article, we will be commenting only on the Studio features relevant to our immediate practice exercise, to allow us to get to the focus of our session more efficiently.

Preparation

Create a New Analysis Services Project within a New Solution

For purposes of our practice session, we will create a copy of the Adventure Works Analysis Services project, one of several samples that are available with (and installable separately from) the Microsoft SQL Server 2005 integrated business intelligence solution. Creating a "clone" of the project

Page 4: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

means we can make changes to select contents while retaining the original sample in a pristine state – perhaps for other purposes, such as using it to accompany relevant sections of the Books Online, and other documentation, as a part of learning more about Analysis Services and other components of the Microsoft integrated business intelligence solution in general.

While the preparation might seem cumbersome, creating all the objects to get us to the point of working with KPIs would require far too many steps to be practical in an article of this size. By using existing project samples (particularly an Analysis Services project that already has KPIs created), and a modified copy of a sample report, we can get a "head start" on solution creation, so that we can get to the focus matter of our session, KPI reporting. Though the steps are numerous, making preparatory modifications, and then making the enhancements to the solution to add the functionality to support the subject of our lesson, can be done easily within the Business Intelligence Studio environment. The end result of our efforts will be to leave us a working example of the specific approach we took, with all the "working parts" in place, to which we can refer in our individual business environments.

To begin, 'we will launch the SQL Server Business Intelligence Development Studio.

1.  Click Start.

2.  Navigate to, and click, the SQL Server Business Intelligence Development Studio, as appropriate.

The equivalent on my PC appears as depicted in Illustration 1.

Illustration 1: Launching SQL Server Business Intelligence Development Studio

We briefly see a splash page that lists the components installed on the PC, and then Visual Studio .NET 2005 opens at the Start page.

3.  Close the Start page, if desired.

4.  Select File --> Open from the main menu.

5.  Click Project / Solution ... from the cascading menu, as shown in Illustration 2.

Page 5: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 2: Selecting a Project ...

The Open Project dialog appears.

6.  Browse to the location of the Adventure Works Analysis Services sample project folder.

Two versions of the Adventure Works Analysis Services project samples are installed, by default (and, therefore, subject to be installed in a different location on our individual machines), in the following location

C:\Program Files\Microsoft SQL Server\90\Tools\Samples\AdventureWorks Analysis Services Project

Of the two samples, we will select the Enterprise project, as it is a more evolved sample than the Standard project. We will copy the Enterprise folder to another location, and work with it within our practice session.

7.  Right-click the Enterprise folder, containing the sample Adventure Works solution, project and associated objects.

8.  Select Copy from the context menu that appears, as depicted in Illustration 3.

Page 6: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 3: Copy the Enterprise Project Folder ...

9.  Navigate, from within the Open Project dialog box, to the location of preference for storing the folder we have copied, and from which we will create our clone project.

10.  Upon arrival within the desired folder, right-click the area within the folder.

11.  Select Paste from the context menu that appears, as shown in Illustration 4.

Illustration 4: Pasting the Copy of the Enterprise Project Folder in a Selected Location

The Enterprise folder appears, via the Open Project dialog, in the new location, as depicted in Illustration 5.

Page 7: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 5: Enterprise Project Folder in Its New Location ...

12.  Right-click the Enterprise folder, within the Open Project dialog.

13.  Select Rename from the context menu that appears, as shown in Illustration 6.

Illustration 6: Renaming the Folder ...

14.  Type the following replacement name into the folder's activated caption box:

RS029 MSAS KPIs in ReportServices

15.  Click outside the caption box to accept the new name, which then appears as depicted in Illustration 7.

Illustration 7: Newly Named Folder ...

16.  Click the new folder, to open it.

The solution file, Adventure Works.sln, and the project file, Adventure Works DW.dwproj, appear at this point, along with two folders containing associated objects.

Page 8: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

17.  Select the Adventure Works.sln file, and then click the Open button, as shown in Illustration 8.

Illustration 8: Opening the Adventure Works.sln File

The Adventure Works solution opens, complete with Adventure Works DW Analysis Services project, and we see the various associated objects appear in Solution Explorer, as depicted in Illustration 9.

Illustration 9: The New Solution, Project and Objects within the Solution Explorer

Ascertain Connectivity of the Shared Relational Data Source

Let's first ensure we have a working shared data source. Many of us will be running "side-by-side" installations of MSSQL Server 2000 and MSSQL Server 2005. This means that our installation of the latter will need to be referenced as a server / instance combination, versus a server name alone (the default for the Adventure Works DW project sample's connection is localhost).

1.  Double-click Adventure Works.ds, within the Data Sources folder seen in Solution Explorer.

The Data Source Designer opens, defaulted to the General tab, and appears with default settings as shown in Illustration 10.

Page 9: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 10: The Data Source Designer with Default Settings ...

2.  Click the Edit button on the Data Source Designer dialog.

The Connection Manager opens, and appears with default settings depicted in Illustration 11.

Illustration 11: The Connection Manager with Default Settings ...

We note that the default Server name is "localhost." While this might prove an adequate setting for a PC with only MSSQL Server 2005 installed (default instance), in the case of many of our installations, the requirement here is for the server / instance combination that correctly identifies the correct MSSQL Server 2005 instance. (Clicking the Test Connection button at this point will provide confirmation whether we need to make this change).

3.  If appropriate, type the correct server / instance name into the Server name box of the Connection Manager. (Mine is MOTHER1\MSSQL2K5, as shown in Illustration 12.)

Page 10: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 12: The Connection Manager, with Corrected Settings ...

4.  Ensure that authentication settings are correct for the local environment.

5.  Click the Test Connection button.

A Connection Manager message box appears, indicating that the Test connection succeeded, assuming that our changes (or lack of same, as appropriate) are proper. The message box appears as depicted in Illustration 13.

Illustration 13: Testing Positive for Connectivity ...

6.  Click OK to dismiss the message box.

7.  Click OK to accept changes, as appropriate, and to dismiss the Connection Manager.

The Data Source Designer appears, with our modified settings, similar to that shown in Illustration 14.

Page 11: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 14: The Data Source Designer with Modified Settings ...

8.  Click OK to close the Data Source Designer, and to return to the development environment.

Deploy the Analysis Services Project

Before going further, let's deploy our Analysis Services project to ensure that we are all "in the same place" with regard to its status. This will ensure issue-free access for Reporting Services as we progress within our practice preparation and procedures.

1.  Right-click the Adventure Works DW Analysis Services project in the Solution Explorer.

2.  Select Deploy from the context menu that appears, as depicted in Illustration 15.

Illustration 15: Initiating Analysis Services Project Deployment ...

Page 12: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

The Build and Deployment processes get underway, as we note the Deployment Progress window appears (by default underneath the Solution Explorer, in the bottom right corner of the development environment.)

NOTE: Be sure to properly configure Properties of the Analysis Services project to ensure that these processes can occur. For more information on configuration, and guidance for settings in the local environment, see the appropriate references in the MSSQL Server 2005 Books Online.

The Build and Deployment processes continue, as each event is logged in the Deployment Progress window. Finally, the processes complete, and we see the Deployment Completed Successfully status announced, as shown in Illustration 16.

Illustration 16: Successful Deployment is Indicated

We are now ready to "clone" a sample report project and proceed with the practice exercise. To prepare for this, we will add a new Report Server project to our existing solution.

Add a New Reporting Services Project

Much in the same manner that we cloned the Adventure Works project, we will add a copy of an existing Report Server project, together with its sample reports, primarily to save time in getting to the focus of our session, working with KPIs within Reporting Services

1.  Right-click the Solution 'Adventure Works level, atop the tree within the Solution Explorer.

2.  Select Add --> Existing Project ... from the cascading context menus that appear, as depicted in Illustration 17.

Page 13: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 17: Adding a Project to the Solution ...

The Add Existing Project dialog appears.

3.  Navigate to the actual location of the AdventureWorks sample reports.

The reports are installed, by default (and, therefore, subject to be installed in a different location on our individual machines), in the following location

C:\Program Files\Microsoft SQL Server\90\Samples\Reporting Services\Report Samples\

4.  Right-click the AdventureWorks Sample Reports folder within the Reports Samples folder.

5.  Select Copy from the context menu that appears, as shown in Illustration 18.

Illustration 18: Copying the Sample Reports Folder ...

6.  Navigate back into the RS029 MSAS KPIs in ReportServices folder, which contains the Analysis Services project clone we created earlier.

7.  Right-click the area within the folder, as we did earlier.

8.  Select Paste from the context menu that appears, as depicted in Illustration 19.

Page 14: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 19: Pasting the Sample Folder in the RS029 MSAS KPIs in ReportServices Folder

The AdventureWorks Sample Reports folder appears, via the Add Existing Project dialog, in the new location, as shown in Illustration 20.

Illustration 20: AdventureWorks Sample Reports Folder in Its New Location ...

9.  Click the AdventureWorks Sample Reports folder to open it.

10.  Select the AdventureWorks Sample Reports.rptproj file that appears, as depicted in Illustration 21.

Illustration 21: Select the AdventureWorks Sample Reports.rptproj File

11.  Click Open to add the Report Server project to our solution.

The AdventureWorks Sample Reports project appears, with associated objects, in Solution Explorer, as shown in Illustration 22.

Page 15: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 22: The New Solution, Project and Objects within the Solution Explorer

While we have saved many steps with our cloning approach, we still have to ascertain connectivity with the Analysis Services data source, just as we did with the relational data source earlier.

Ascertain Connectivity of the Analysis Services Shared Data Source

Let's ensure we have a working shared data source to facilitate reporting from our Analysis Services cube, Adventure Works, for the same reason that we noted when completing this step for the relational data source: Because many of us will be running "side-by-side" installations of MSSQL Server 2000 and MSSQL Server 2005. Our installation of the latter will need to be referenced as a server / instance combination, versus a server name alone, (the default for Analysis Services data source within the Adventure Works Sample Reports project is (local)). We may also need to "repoint" the data source to the Adventure Works Analysis Services database contained within our new solution.

1.  Double-click the second of the two shared data sources within the Adventure Works Sample Reports project, AdventureWorksAS.rds, as depicted in Illustration 23.

Illustration 23: Open the Shared Data Source Dialog for the Analysis Services Data Source ...

The Shared Data Source dialog opens, defaulted to the General tab, and appears with default settings as shown in Illustration 24.

Page 16: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 24: The Shared Data Source Dialog with Default Settings ...

2.  Click the Edit button on the Shared Data Source dialog.

The Connection Properties dialog opens, and appears with default settings depicted in Illustration 25.

Illustration 25: The Connection Properties Dialog with Default Settings ...

We note that the default Server name is "(local)," once again. While this might prove an adequate setting for a PC with only MSSQL Server 2005 installed (default instance), in the case of many of our installations, the requirement here is for the server / instance combination that correctly identifies the correct MSSQL Server 2005 instance. (Clicking the Test Connection button at this point will, again, provide confirmation whether we need to make this change).

3.  If appropriate, type the correct server / instance name into the Server name box of the Connection Properties dialog. (Mine is MOTHER1\MSSQL2K5, as before).

4.  In the Connect to a database section in the bottom half of the dialog, in the selector box labeled Select or enter a database name, select Adventure Works DW.

Page 17: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

The Connection Properties dialog appears, with our setting modifications, as shown in Illustration 26.

Illustration 26: The Connection Properties Dialog with Modified Settings ...

5.  Ensure that authentication settings are correct for the local environment, as we did for the relational data source above

6.  Click the Test Connection button.

A message box appears, indicating that the Test connection succeeded, assuming that our changes (or lack of same, as appropriate) are appropriate. The message box appears as depicted in Illustration 27.

Illustration 27: Testing Positive for Connectivity ...

7.  Click OK to dismiss the message box.

8.  Click OK to accept changes, and to dismiss the Connection Properties dialog.

The Shared Data Source dialog appears, with modified settings, similar to that shown in Illustration 28.

Page 18: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 28: The Shared Data Source Dialog with Modified Settings ...

9.  Click OK to close the Shared Data Source dialog, and to return to the development environment.

We are now ready to modify a sample report and proceed with some exposure to KPIs in Reporting Services.

Modify the OLAP Report to Work with Our Cube

When we copied the installed sample reports into our new project folder, we insulated the originals from modification, to allow their continued use with the tutorial that ships with Reporting Services, as well as within other training endeavors. In this session, we will work only with the OLAP report member of the report set in our project, Sales Reason Comparisons.rdl.

Let's make some modifications to the report to render it more useful to our present focus. First, we will recreate the report and give it a new name. We will then be ready to concentrate on using KPIs within the report in a useful way.

1.  In Solution Explorer, right-click the Reports folder, within the AdventureWorks Sample Reports project that we added earlier

2.  Select Add from the context menu that appears.

3.  Select Existing Item ... from the context menu that cascades from the first, as depicted in Illustration 29.

Illustration 29: Select Add --> Existing Item ...

Page 19: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

4.  Within the Add Existing Item dialog that appears (it should open to reveal the contents of our newly copied AdventureWorks Sample Reports folder), right-click the Sales Reason Comparisons.rdl file.

5.  Select Copy from the context menu that appears, as we have done with other objects in previous sections.

6.  Right-click elsewhere in the empty space of the folder.

7.  Select Paste, once again, to create a duplicate of the selected object.

8.  Right-click the new file, named Copy of Sales Reason Comparisons.rdl, by default.

9.  Select Rename from the context menu that appears, as we have done with other objects earlier.

10.  Rename the file to the following:

Analysis Services KPIs.rdl

11.  Select the newly renamed file within the Add Existing Item dialog.

12.  Click Add to add the new file to the AdventureWorks Sample Reports project in Business Intelligence Development Studio, as shown in Illustration 30.

Illustration 30: Adding the New Report to the Report Server Project ...

Analysis Services KPIs.rdl appears in the Solution Explorer.

13.  Double-click Analysis Services KPIs.rdl to open it.

Analysis Services KPIs.rdl opens in the design environment.

14.  Click the Preview tab within Report Designer, to ascertain proper connectivity and general operation of the new report file.

Analysis Services KPIs.rdl executes, and appears as depicted in Illustration 31.

Page 20: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 31: Analysis Services KPIs.rdl in Preview ...

Having determined that all is "wired correctly," we are ready to add KPIs to our report.

Procedure

Reporting with Analysis Services KPIs

Add KPI Values to the Report

Our clone of the Sales Reason Comparisons report, the sole OLAP report in the sample set, will serve as a quick "framework," since it is already in place and has several attributes that will allow us to modify it quickly. We can then add KPI values.

1.  Click the Data tab to return to Data view.

We arrive at the MDX Query Designer, where we will be working in Design View for this part of our session.

2.  Select the sole item (Product) in the Filter pane, in the upper right corner of the Query Designer.

3.  Click the Delete button to remove the filter, as shown in Illustration 32.

Illustration 32: Deleting the Product Filter ...

The filter disappears, and the grid updates (unless Auto Execute is disabled) in the Results pane below.

4.  Right click a point with the Results pane.

5.  Select Clear Grid to begin a fresh start with the DataSet, as depicted in Illustration 33.

Page 21: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 33: Clearing the Results Pane Grid

6.  In the Metadata Browser pane, expand the Product dimension in the metadata tree by clicking the "+" sign to its immediate left.

7.  Drag the Subcategory attribute from the Metadata Browser pane over to drop on the main Results pane, as shown in Illustration 34.

Illustration 34: Adding Product Subcategory to the Data Set

8.  In the Metadata Browser pane, expand KPIs in the tree.

9.  Drag the Internet Revenue KPI from the Metadata Browser pane over to right of the new Subcategory column, dropping it when the red line appears, as depicted in Illustration 35.

Page 22: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 35: Adding the KPI to the Data Set

We see that the KPI, which represents a collection of calculations that we can use to support decisions and evaluate success, and which are associated with a given measure group (or, alternatively, all measure groups) within the cube, has brought along four separate members. The member components of the Internet Revenue KPI are as follows:

Value – an MDX numeric expression that returns the actual value of the KPI. Goal - an MDX numeric expression that typically returns the targeted (budgeted, forecast, etc.)

value of the KPI. Status - an MDX expression representing the state of the KPI at a specified point in time. The

Status expression returns normalized values: a "-1" (interpreted as "bad" or "low"), a "0" (interpreted as "acceptable" or "medium," etc.) or a "1" (interpreted as "good" or "high").

Trend - an MDX expression evaluating the value of the KPI over time. The Trend allows information consumers to ascertain progress / improvement or lack of same over any business-relevant, time-based criterion.

The Goal and Value components are typically the most significant and common, although Status and Trend, which are based upon Goal and Value, are often in demand, as well. Other calculations are available besides the above examples. For an in-depth discussion of Analysis Services 2005 KPIs, see my article Mastering Enterprise BI: Introduction to Key Performance Indicators.

Let's add a couple of filters at this point. While we might select multiple years' operations for analysis, we will limit our practice report to Fiscal Year 2004. In addition, we will filter our null values to generate a more compact report.

10.  In the Filter pane, select Date in the Dimension selector.

11.  Select Date.Fiscal Year in the Hierarchy selector of the Filter pane, as depicted in Illustration 36.

Page 23: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 36: Select Date.Fiscal Year in the Hierarchy Selector

12.  Select Equal in the Operator selector for the Filter.

13.  Select FY 2004 in the Filter Expression selector of the Filter pane as shown in Illustration 37.

Illustration 37: Select FY 2004 in the Filter Expression Selector

The Filter pane, with our selections, appears as depicted in Illustration 38.

Illustration 38: Filter Pane with All Selections in Place

We are now ready to modify the matrix data region on the Layout tab, where the layout remains the same even though we have effectively redesigned the underlying DataSet.

14.  Click the Layout tab.

15.  Select the left-most Data field within the matrix to select it, as shown in Illustration 39.

Illustration 39: Select the Left-most Data Field in the Matrix

16.  Press the DELETE key on the PC.

17.  Delete the second and third Data fields in the matrix in similar fashion.

Page 24: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

The second Data field (along with the respective column) disappears and the third Data field clears, leaving the Data watermark exposed, as depicted in Illustration 40.

Illustration 40: Data References Have Been Removed

Next, we will eliminate the Report Parameter for Product Category (which referenced the Product filter we removed earlier in the Filter pane of the Data tab.)

18.  Select Report --> Report Parameters ... from the main menu, as shown in Illustration 41.

Illustration 41: Select Report --> Report Parameter from the Main Menu

19.  Select the sole Product Category parameter appearing in the Parameters list on the left side of the Report Parameters dialog, which appears next.

20.  Click the Remove button underneath the Parameters list, as depicted in Illustration 42.

Page 25: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 42: Remove the Pre-Existing Report Parameter ...

21.  Click OK to accept the modification and dismiss the Report Parameters dialog.

We return to the Layout tab. Next, we will modify some properties of the matrix data region.

22.  Click any point within the matrix to cause its gray header and row borders to appear.

23.  Right-click the upper left corner of the matrix, as shown in Illustration 43.

Illustration 43: Getting to the Matrix Properties ...

24.  Select Properties from the context menu that appears (the gray borders disappear, and the matrix data region assumes a semi-transparent outline), as depicted in Illustration 44.

Page 26: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 44: Select Properties from the Context Menu

The Matrix Properties dialog opens, defaulted to the General tab.

25.  Click the Groups tab.

26.  In the Rows list in the top half of the Groups tab, select the sole group (matrix1_Sales_Reason).

27.  Click the Edit button, as shown in Illustration 45.

Illustration 45: Editing the Rows Group ...

The Grouping and Sorting dialog opens, defaulted to the General tab.

28.  Replace the contents of the Name field with the following:

matrix1_ProductSubcategory

Page 27: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

29.  In the Group on section, select the following to replace the current contents of the top row of the Expression list:

=Fields!Subcategory.Value

The Grouping and Sorting dialog - General tab appears as depicted in Illustration 46.

Illustration 46: Grouping and Sorting Dialog for Row Group – with Modifications

30.  Click OK to accept the modifications and to return to the Matrix Properties dialog – Groups tab.

31.  In the Columns list in the bottom half of the Groups tab, select the middle group (matrix1_Sales_Territory_Group).

32.  Click the Delete button, as shown in Illustration 47.

Illustration 47: Deleting a Column Group

The Matrix Properties dialog - Groups tab appears, with our modifications, as depicted in Illustration 48.

Page 28: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 48: Matrix Properties Dialog – Groups Tab – with Modifications

33.  Click OK to accept our changes, and to return to the Layout tab.

34.  Right-click the textbox for the Rows group, currently containing the expression "=Fields!Sales_Reason.Value."

35.  Select Expression from the context menu that appears, as shown in Illustration 49.

Illustration 49: Modifying the Expression for the Rows Group Textbox

36.  Replace the current occupant of the Expression box, atop the Expression Editor that appears next, with the following:

=Fields!Subcategory.Value

The Expression Editor, with our new expression, appears as depicted in Illustration 50.

Page 29: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 50: Expression Editor – New Rows Group Textbox Expression

37.  Click OK to accept the new expression and to dismiss the Expression Editor.

38.  Right-click the column label textbox, currently labeled Sales Reason, above the Rows group textbox.

39.  Select Expression ... from the context menu, once again.

40.  Replace the current occupant of the Expression box, again atop the Expression Editor that appears next, with the following:

=""& vbcrlf & vbcrlf &" Product Subcategory"

The Expression Editor, with our new expression, appears as shown in Illustration 51.

Illustration 51: Expression Editor – New Textbox Label Expression

41.  Click OK to accept the new expression and to dismiss the Expression Editor.

We are now ready to bring the KPI values into the matrix from Datasets window, where they currently appear as fields.

42.  Open the Datasets window with the tab to the left of the Layout tab, as depicted in Illustration 52.

Page 30: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 52: Open the Datasets Window

NOTE: If the tab is not in its default position, open the window by selecting View ---> Datasets, as shown in Illustration 53.

Illustration 53: Select View --> Datasets to Resurrect the Datasets Window, if Required

43.  Within the Datasets window, expand the ProductData Report Dataset, so that all four Internet Sales KPI members are exposed.

44.  Drag the Internet Revenue Status field from the Datasets window to the empty Data field within the matrix data region, on the canvas in Layout view, as depicted in Illustration 54.

Page 31: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 54: Adding the KPI Field to the Matrix Data Region

45.  Drag the Internet Revenue Trend field from the Datasets window to the immediate right of the Data field into which we dropped the Internet Revenue Status field in the last step. The right border of the b field will assume a white bracket shape when the positioning is correct to drop the field and create a new column, as shown in Illustration 55.

Illustration 55: The Right Border Indicates that the Drop Point is Correct for a New Column ...

A new Data field / column is created when we drop the Internet Revenue Trend field to the immediate right of the Internet Revenue Status field.

46.  In like manner, drag the Internet Sales Amount field from the Datasets window to the immediate right of the Data field into which we dropped the Internet Revenue Trend field.

47.  Finally, drag the Internet Revenue Goal field from the Datasets window to the immediate right of the Internet Sales Amount field.

48.  Right-click the left most Data column heading in the matrix data region (currently labeled Internet Total Product Cost).

49.  Select Expression... from the context menu that appears, as depicted in Illustration 56.

Illustration 56: Changing the Pre-Existing Column Heading ...

Page 32: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

50.  Within the expression box at the top of the Expression Editor, replace the existing expression with the following:

Internet Revenue Status

51.  Click OK to accept the modification and dismiss the Expression Editor.

52.  Holding down the SHIFT key, click the Data column heading for each of the four new Data fields, to select them simultaneously.

53.  Click the Center alignment button in the toolbar, as depicted in Illustration 57.

Illustration 57: Centering the Column Labels ...

54.  Finally, right-click the Internet Sales Amount Data field (the Data field to the immediate left of the far right field).

55.  Select Properties from the context menu that appears, as shown in Illustration 58.

Illustration 58: Select Properties from the Context Menu ...

The Textbox Properties dialog opens – defaulted to the General tab.

56.  Click the Format tab.

Page 33: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

57.  Type the following into the Format code box in the upper left corner of the tab:

C

The Textbox Properties dialog – Format tab appears as depicted in Illustration 59.

Illustration 59: Textbox Properties-Format Tab, Format Code Setting

58.  Click OK to accept the change and to close the Textbox Properties dialog.

59.  Perform the same Format setting accomplished in the last few steps for the far right Data field, Internet Revenue Goal.

60.  Holding down the SHIFT key, once again, click the Row group label textbox (containing "=Fields!Subcategory.Value" ) and the data textboxes for each of the four new Data fields, to select them simultaneously, as we did earlier with their column heading textboxes.

61.  Select 9 in the Font Size selector, on the left side of the Report Formatting toolbar (which we accessed earlier for the Center button, when aligning the column headings), atop the design environment, as shown in Illustration 60.

Illustration 60: Slightly Reducing the Font for the Data Fields ...

The Analysis Services KPIs report, in Layout view, with our KPI and column label additions, appears as depicted in Illustration 61.

Page 34: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 61: Analysis Services KPIs Report – Layout View

62.  Click the Preview tab.

The report is executed, and appears as partially shown in Illustration 62.

Illustration 62: Generated Report in Preview (Partial View)

A cursory review of the report's pages reveals that the sample data appears to match Internet Sales Amount with Internet Revenue Goal in every case where we have a non-zero number. This is not surprising for a sample data set, but we are not impaired in our immediate pursuits, as we have occurrences of -1, 0, and 1 throughout the report. We will not delve into the KPIs themselves at this point – we have what we need to move to the next (and concluding) section.

63.  Return to the Layout tab.

Drive Indicators with KPI Values in the Report

I mentioned earlier that KPIs typically wind up in graphical form to summarize, at a glance, a status, trend, or other condition (usually in a balanced scorecard, digital dashboard, or similar presentation backdrop). We have been able to pull in the numerical values of the KPIs, but Analysis Services does not expose a direct means of presenting the KPI graphics that exist within Analysis Services (that is, there are no report items that are included to do this, etc.)

We can still obtain an identical presentation effect in Reporting Services. We just have to supply our own graphics. Working with Cognos and other enterprise BI suites over the years, particularly at the point, and beyond, where all were venturing into web presentation and delivery, I often used the easily accessible image files included with the applications to achieve my own ends (I often simply wanted to replace them with my own or client images, such as corporate logos, etc., to customize the appearance of the reports and other displays we presented via the internet / intranets). We can do something

Page 35: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

similar with the images that are included to support Reporting Services' KPIs. We can simply use conditional logic to turn all those 1's, 0's, and -1's into a corresponding image.

Let's put the same reasoning to work in our Analysis Services KPIs report by taking the following steps:

1.  Drag an Image report item from the Toolbox into the Data field with the column label Internet Revenue Status, as depicted in Illustration 63.

Illustration 63: Placing an Image Item into a KPI Data Field

The Welcome to the Image Wizard page of the Image Wizard appears, as shown in Illustration 64.

Illustration 64: Welcome to the Image Wizard ...

2.  Click the Next button to proceed with the Image Wizard.

The Select the Image Source page appears next.

3.  Select the Embedded radio button, to direct the Image Wizard to embed the image within the report file.

The Select the Image Source page appears, with our setting, as depicted in Illustration 65.

Page 36: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 65: Choosing to Embed the Image ...

4.  Click the Next button to continue.

The Choose the Embedded Image page appears.

5.  Click the New Image button.

The Import Image dialog appears.

6.  Navigate to the KPI image files that were stored on the system with the installation of Analysis Services 2005.

The image files were put in place to support the KPI Browser in Analysis Services, and will serve as a handy source of image files for this practice session. (We can certainly use other images, if they are accessible, and of an acceptable format, size, and so forth to be used by Reporting Services.) The Images folder is installed, by default (and, therefore, subject to be installed in a different location on our individual machines), in the following location:

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\ DataWarehouseDesigner\KPIsBrowserPage\

7.  From inside the Import Image dialog, right-click the Images folder within the KPIsBrowserPage folder.

8.  Select Copy from the context menu that appears, as shown in Illustration 66.

Page 37: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 66: Copying the KPI Images Folder ...

9.  Navigate back to the RS029 MSAS KPIs in ReportServices folder, which contains the Analysis Services and Reporting Services project clones we created earlier.

10.  Right-click the area within the folder, as we did earlier.

11.  Select Paste from the context menu that appears, as depicted in Illustration 67.

Illustration 67: Pasting the Sample Folder in the RS029 MSAS KPIs in ReportServices Folder

The Images folder appears in the new location.

12.  Right-click the Images folder.

13.  Select Rename from the context menu that appears, as we have done before.

14.  Rename the folder to the following:

KPI Image Collection

Page 38: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

The KPI Image Collection folder appears, via the Import Image dialog, in the new location, as shown in Illustration 68.

Illustration 68: KPI Image Collection Folder in Its New Location ...

15.  Click the KPI Image Collection folder to open it.

16.  Select the Stoplight_Multiple0.gif (the "red light") file, as depicted in Illustration 69.

Illustration 69: Selecting a KPI Image for the Report

17.  Click Open to add the specified image file to our report.

The Import Image dialog closes, and we see the image file rendered within the viewer of the Choose the Embedded Image page.

18.  Click the New Image button again.

19.  Select the Stoplight_Multiple1.gif (the "yellow light") file.

20.  Click Open to add the specified image file to the report.

We see the second image rendered within the viewer of the Choose the Embedded Image page.

21.  After the same fashion with which we have added the two images above, add the following additional images to the report.

Stoplight_Multiple2.gif Arrow_Status_Asc0.gif

Page 39: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Arrow_Status_Asc2.gif Arrow_Status_Asc4.gif

Once our additions are complete, the acquired images appear within the viewer of the Choose the Embedded Image page.

22.  Ensure that the first image we added, Stoplight_Multiple0.gif (the "red light") is selected.

Our selection (circled), atop the other KPI images, appears within the viewer of the Choose the Embedded Image page as shown in Illustration 70.

Illustration 70: New Image Acquisitions Appear in the Choose the Embedded Image Page (Partial View)

23.  Click Next to accept our image choice, and to continue with the Image Wizard.

We arrive at the Completing the Wizard page, which affords us an opportunity to confirm our selection, as depicted in Illustration 71.

Illustration 71: The Completing the Wizard Page

24.  Click Finish to place the image in the Data field, and to dismiss the Image Wizard.

Page 40: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

"Grab" the bottom border of the bottom row in the matrix data region, using the cursor on the bottom left corner of the gray area, and increase the height of the row (I gave it a height of 2 in.) enough to easily accommodate the image we have placed in the data field, as shown in Illustration 72.

Illustration 72: Increasing Row Height to Accommodate the Image ...

Previewing the report at this juncture would mean we see the "red light" in every data field in the column. This is where conditional formatting comes in.

25.  Click the image to select it.

26.  Select <Expression ...> in the selector for the Value property, within the Properties window for the image, as depicted in Illustration 73.

Illustration 73: Select <Expression...> to Replace the Value Property in the Properties Window

The Expression Editor opens.

27.  Replace stoplight_multiple0, which currently appears in the Expression box of the Editor, with the folowing expression:

=IIF(Fields!Internet_Revenue_Status_.Value = -1, "stoplight_multiple0", IIF(Fields!Internet_Revenue_Status_.Value = 0, "stoplight_multiple1", "stoplight_multiple2") )

The Expression Editor, with our expression in place, appears as shown in Illustration 74.

Page 41: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 74: Expression Editor with Conditional Expression in Place ...

28.  Click OK to accept the expression and to dismiss the Editor.

Now, let's perform the same image insertion and conditioning steps for the Internet Revenue Trend Data field.

29.  Drag an Image report item from the Toolbox into the Data field with the column label Internet Revenue Trend.

30.  Click the Next button on the Welcome page of the Image Wizard, to proceed with the Image Wizard.

The Select the Image Source page appears next.

31.  Select the Embedded radio button, as before, to direct the Image Wizard to embed the image within the report file.

32.  Click the Next button to continue.

The Choose the Embedded Image page appears.

33.  Ensure that Arrow_Status_Asc4.gif (the "green, upward-pointing arrow") is selected.

Our selection (circled), underneath the other KPI images, appears within the viewer of the Choose the Embedded Image page as partially depicted in Illustration 75.

Page 42: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 75: Our New Image Selection in the Choose the Embedded Image Page (Partial View)

34.  Click Next to accept additions and continue with the Image Wizard.

We arrive at the Completing the Wizard page, which affords us an opportunity to confirm our selection, once again.

35.  Click Finish on the Completing the Wizard page to add the image to the report file, and to dismiss the Image Wizard.

Adding the conditional expression is all that remains:

36.  Click the image to select it.

37.  Select <Expression ...> in the selector for the Value property, within the Properties window for the image, as we did with the first image.

The Expression Editor opens.

38.  Replace arrow_status_asc4, which currently appears in the Expression box of the Editor, with the following expression:

=IIF(Fields!Internet_Revenue_Trend.Value = -1, " arrow_status_asc0", IIF(Fields!Internet_Revenue_Trend.Value = 0, " arrow_status_asc2", " arrow_status_asc4") )

The Expression Editor, with our expression in place, appears as shown in Illustration 76.

Page 43: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

Illustration 76: Expression Editor with Conditional Expression in Place ...

39.  Click OK to accept the expression and to dismiss the Editor.

Now let's take a look at the results of our handiwork.

40.  Click the Preview tab.

The Analysis Services KPIs report executes, and returns our KPIs as expected, as depicted in Illustration 77.

Illustration 77: KPIs at Work in the Analysis Services KPIs Report ...

We could certainly have obtained artwork that was more fitly sized, and perhaps a data set with a bit more diversity, which might have produced the full spectrum of Status and Trend KPI values. Regardless, the concepts are the same, particularly in any scenario where we undertake to generate graphics to represent Analysis Services KPIs in Reporting Services, rather than remaining limited to their use within the Analysis Services KPI Browser.

1.  Select File --> Save All on the main menu, to save our work to this point.

Page 44: Tutorial 29 Mastering OLAP Reporting Reporting With Analysis Services KPIs

2.  Select File --> Exit, to leave the Business Intelligence Development Studio, when ready.

Conclusion ...

In this article, we introduced another powerful new tool that makes its debut with MSSQL Server Analysis Services 2005, Key Performance Indicators ("KPIs"). Key Performance Indicators close yet another "out-of-the-box" capabilities gap between the Microsoft integrated business intelligence solution and the formerly dominant enterprise BI suites. We discussed the purpose and uses of KPIs, and stated that, although these indicators originate in Analysis Services, and are typically viewed therein via an internal browser, we are not limited to accessing and using KPIs within Analysis Services. The focus of this article was to show how we can flexibly present KPIs within Reporting Services to support decision making, analysis and reporting.

After initially discussing Analysis Services KPIs, we shifted to the focus of our hands-on practice session, surrounding the use of the indicators within a report we created in Reporting Services. In preparation, we created a new Analysis Services Project within the Business Intelligence Development Studio Solution, to which we added a new Reporting Services Project. We ensured connectivity with the respective data sources involved within the projects, and then modified a sample OLAP report to work with KPIs found in the sample cube. We next added KPI values to the report. Finally, we demonstrated an approach for using KPIs to drive graphical indicators in the report. Throughout the steps of our practice session, we discussed, at appropriate junctures, various settings and techniques involved in achieving our objectives.