16
Chapter 4: Processing Cubes in Analysis Services Using Microsoft SQL Server Management Studio 4-1 CHAPTER 4: PROCESSING CUBES IN ANALYSIS SERVICES USING MICROSOFT SQL SERVER MANAGEMENT STUDIO Objectives The objectives are: Provide an overview of Microsoft SQL Server Analysis Services. Describe the concept of Analysis Services Environment. Outline Analysis Services’ integrated environments. Provide an overview of a cube. Build a pivot table on the basis of a cube. Manipulate the data in the created pivot table. Introduction This chapter provides an overview of Microsoft ® SQL Server ® Analysis Services (SSAS), and analysis services environments including Microsoft SQL Server Management Studio and Business Intelligence Development Studio. The second part of the chapter demonstrates how to use Microsoft SQL Server Management Studio to browse a cube created in Chapter 3, "Configuring a BA Database in Microsoft Dynamics NAV", and build a pivot table based on that cube. The chapter also provides on giving a general review of the environments and the Microsoft ® SQL Server ® Management Studio functionality based on a level that is sufficient for completing a business intelligence task. Microsoft SQL Server Management Studio is used for business intelligence purposes as an alternative to other online analytical processing (OLAP) client applications such as Business Analytics for Microsoft Dynamics NAV or Microsoft ® Office Excel ® . If Microsoft SQL Server Analysis Services is being used, for more details and depending on the version of the Microsoft SQL Server installed, refer to either "Course 2791A: Implementing and Maintaining Microsoft SQL Server 2005 Analysis Services" or "Course 6234A: Implementing and Maintaining Microsoft SQL Server 2008 Analysis Services." Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Na2009 enus biip_04

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Na2009 enus biip_04

Chapter 4: Processing Cubes in Analysis Services Using Microsoft SQL Server Management Studio

4-1

CHAPTER 4: PROCESSING CUBES IN ANALYSIS SERVICES USING MICROSOFT SQL SERVER MANAGEMENT STUDIO Objectives

The objectives are:

• Provide an overview of Microsoft SQL Server Analysis Services. • Describe the concept of Analysis Services Environment. • Outline Analysis Services’ integrated environments. • Provide an overview of a cube. • Build a pivot table on the basis of a cube. • Manipulate the data in the created pivot table.

Introduction This chapter provides an overview of Microsoft® SQL Server® Analysis Services (SSAS), and analysis services environments including Microsoft SQL Server Management Studio and Business Intelligence Development Studio.

The second part of the chapter demonstrates how to use Microsoft SQL Server Management Studio to browse a cube created in Chapter 3, "Configuring a BA Database in Microsoft Dynamics NAV", and build a pivot table based on that cube.

The chapter also provides on giving a general review of the environments and the Microsoft® SQL Server® Management Studio functionality based on a level that is sufficient for completing a business intelligence task. Microsoft SQL Server Management Studio is used for business intelligence purposes as an alternative to other online analytical processing (OLAP) client applications such as Business Analytics for Microsoft Dynamics NAV or Microsoft® Office Excel®. If Microsoft SQL Server Analysis Services is being used, for more details and depending on the version of the Microsoft SQL Server installed, refer to either "Course 2791A: Implementing and Maintaining Microsoft SQL Server 2005 Analysis Services" or "Course 6234A: Implementing and Maintaining Microsoft SQL Server 2008 Analysis Services."

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 2: Na2009 enus biip_04

Business Intelligence for IT Professionals in Microsoft Dynamics® NAV 2009

4-2

Microsoft SQL Server Analysis Services Microsoft SQL Server Analysis Services delivers OLAP and data mining functionality for business intelligence applications. Analysis Services supports OLAP by letting you design, create, and manage multidimensional structures that contain data aggregated from other data sources, such as relational databases.

Analysis Services combines the best aspects of traditional OLAP-based analysis and relational-based reporting. Analysis Services does this by allowing developers to define a single data model, called a Unified Dimensional Model (UDM) over one or more physical data sources. All end user queries from OLAP, reporting, and custom Business Intelligence (BI) applications access the data in the underlying data sources through the UDM, which provides a single business view of this relational data.

Analysis Services Environment Microsoft SQL Server consolidates server administration and business object creation into two integrated environments:

• Microsoft SQL Server Management Studio • Microsoft SQL Server Business Intelligence Development Studio

IT professionals use Business Intelligence Development Studio to develop and deploy Analysis Services projects, and use Microsoft SQL Server Management Studio to manage these projects.

Both studio environments use solutions and projects to manage and organize business intelligence projects. They both also offer fully integrated source control functionality if a source control provider such as Team Foundation Server is installed.

Neither of the studio environments is in itself a part of Visual Studio .NET although they both use the containers and visual elements established in Microsoft Visual Studio .NET (for example, projects, solutions, Solution Explorer, and Toolbox). The studio environments included with Microsoft SQL Server are separate environments designed for business application developers who work with Microsoft SQL Server, SQL Server Mobile, Analysis Services, Integration Services and Reporting Services. These tools cannot be used to build custom applications or support large development projects.

Microsoft SQL Server Management Studio

SQL Server Management Studio is an integrated environment for accessing, configuring, managing, and administering all components of Microsoft SQL Server. SQL Server Management Studio combines a broad group of graphical tools with a rich script editor to provide access to Microsoft SQL Server for developers and administrators.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 3: Na2009 enus biip_04

Chapter 4: Processing Cubes in Analysis Services Using Microsoft SQL Server Management Studio

4-3

To access Microsoft SQL Server Management Studio, go to Start > Programs > Microsoft SQL Server 2008 (or Microsoft SQL Server 2005) > SQL Server Management Studio.

FIGURE 4.1 THE MICROSOFT SQL MANAGEMENT STUDIO WINDOW

Microsoft SQL Server Management Studio combines the capabilities of Enterprise Manager and Query Analyzer, included in previous releases of SQL Server, into a single environment. In addition, Microsoft SQL Server Management Studio provides an environment for managing Analysis Services, Integration Services, Reporting Services, and XQuery. Microsoft SQL Server Management Studio, is used to manage Analysis Services objects (perform back-ups, processing, and so on), and to create new objects directly on an existing Analysis Services instance. Microsoft SQL Server Management Studio provides an Analysis Server Scripts project which is used to save scripts written in Multidimensional Expressions (MDX), Data Mining Extensions (DMX), and XML for Analysis (XMLA). Analysis Server Scripts projects are usually used for performing management tasks or recreating objects, such as databases and cubes, on Analysis Services instances. This chapter demonstrates how to use the Microsoft SQL Server Management Studio browser to analyze cubes configured in Microsoft Dynamics NAV 2009.

Microsoft SQL Server Business Intelligence Development Studio

Business Intelligence Development Studio is an integrated environment, based on Microsoft Visual Studio. It is also used for creating business intelligence solutions, such as cubes, data sources, reports, and Integration Services packages.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 4: Na2009 enus biip_04

Business Intelligence for IT Professionals in Microsoft Dynamics® NAV 2009

4-4

To work with Microsoft SQL Server Business Intelligence Development Studio, open the Microsoft Visual Studio: go to Start > Programs > Microsoft SQL Server 2008 (or Microsoft SQL Server 2005) > SQL Server Business Intelligence Development Studio.

FIGURE 4.2 MICROSOFT VISUAL STUDIO

In Business Intelligence Development Studio, Analysis Services projects are created that contain configuration of Analysis Services objects (cubes, dimensions, and so on). The projects are stored in XML files that contain Analysis Services Scripting Language (ASSL) elements, and they can be created from scratch or on the basis of a project template. These projects are contained in solutions that can also contain projects from other SQL Server components, including SQL Server Integration Services (SSIS) and SQL Server Reporting Services (SSRS). Analysis Services projects can be developed as part of a solution that is independent of any particular Analysis Services instance. You can deploy the objects to an instance on a test server for testing during development, and then use the same Analysis Services project to deploy your objects to instances on one or more staging or production servers.

NOTE: For information on how to design a report in Microsoft SQL Business Intelligence Development Studio, refer to Chapter 5, "Designing Reports in Microsoft SQL Server Business Intelligence Development Studio,” in this manual.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 5: Na2009 enus biip_04

Chapter 4: Processing Cubes in Analysis Services Using Microsoft SQL Server Management Studio

4-5

Browsing a Cube and Building a Pivot Table This section describes how to use Microsoft SQL Server Management Studio for business intelligence purposes. The demonstration covers the basic features of working with a cube.

NOTE: Most of the actions in the demonstration procedure, especially those that are aimed at manipulating data, are optional and can be omitted depending on the way you want the data to be presented and on the depth of the analysis to be performed.

Demonstration: Browsing Cube Data and Building a Pivot Table

This demonstration uses Microsoft SQL Server Management Studio to browse in the Sales and Purchase Efficiency virtual cube created in Chapter 3, "Configuring a BA Database in Microsoft Dynamics NAV". It then builds a pivot table to meet the business intelligence tasks for Kevin, the Sales Manager, from the scenario in the same chapter. In particular, the pivot table provides data for Kevin to view the sold items aggregated by customers for a time period and to analyze the item quantity, amount, and gross margin. The items must be from the transactions in local currency, meaning, from transactions with domestic customers.

NOTE: This demonstration elaborates on the usage of SQL Server Management Studio for analysis purposes. In general, the tool is often used to validate the structure of the created cube(s).

The browse a cube and build a pivot table, use the following procedure.

Browsing a Cube

1. In the Microsoft SQL Server Management Studio window, connect to Analysis Services.

2. In the Object Explorer, expand Databases > Trade Analysis > Cubes.

3. Right-click the Sales and Purchase Efficiency cube and select Browse.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 6: Na2009 enus biip_04

Business Intelligence for IT Professionals in Microsoft Dynamics® NAV 2009

4-6

The cube components are displayed in the Metadata pane (numbered 1 in the screenshot).

FIGURE 4.3 CUBE COMPONENTS IN THE METADATA PANE

The Filter (or Subcube) pane (numbered 2) is used to restrict/filter the data to be browsed in the Data (or Result) pane (numbered 3).

Building a Pivot Table

Adding/ Removing Measures

1. To add dimensions to a pivot table, drag the measures you want to add from the Metadata pane to the details area of the Data pane, which is labeled Drop Totals or Detail Fields Here. As the additional measures are dragged, they are added as columns in the Details area. A vertical line indicates where each additional measure will drop. Dragging the Measures folder drops all the measures into the details area.

2. To remove a measure from the details area, either drag it out of the Data pane, or right-click it and then click Remove Total on the shortcut menu.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 7: Na2009 enus biip_04

Chapter 4: Processing Cubes in Analysis Services Using Microsoft SQL Server Management Studio

4-7

3. Drag the Amount and Quantity measures from the SalesInvoiceLine measure group and the Gross Margin calculated measure.

FIGURE 4.4 THE MEASURES ARE ADDED TO THE DATA PANE

Adding/ Removing Dimensions

1. Drag the hierarchies or dimensions to the row or column field areas. 2. To remove a dimension, either drag it out of the Data pane, or right-

click it and then click Remove Field on the shortcut menu. 3. Drag the Customer and Sales Invoice Line No_ dimensions to the

Drop Row Fields Here area in the Data pane and the Posting Date dimension to the Drop Column Fields Here area. This is necessary for Kevin's analysis of gross margin for each date or time period.

FIGURE 4.5 VIEWING MEASURES IN THE CONTEXT OF DIMENSIONS

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 8: Na2009 enus biip_04

Business Intelligence for IT Professionals in Microsoft Dynamics® NAV 2009

4-8

Viewing Dimension Hierarchy

To view the dimension members, select the hierarchy to view in the Metadata pane, and then expand the hierarchy tree to view members.

FIGURE 4.6 VIEWING DIMENSION MEMBERS

NOTE: If the dimension has more than one translation, select the language on the toolbar if necessary.

Adding or Removing Filters

You can restrict the data displayed in the pivot table by setting filters by dimension hierarchies. You can use either of two methods to add a filter:

• Expand a dimension in the Metadata pane, and then drag a hierarchy to the Filter pane.

• In the Dimension column of the Filter pane, click <Select dimension>, select a dimension from the list, then click <Select hierarchy> in the Hierarchy column to select a hierarchy from the list.

After the hierarchy is specified, select the operator that defines how the expression in the Filter Expression column is applied to the selected hierarchy.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 9: Na2009 enus biip_04

Chapter 4: Processing Cubes in Analysis Services Using Microsoft SQL Server Management Studio

4-9

NOTE: For information on how to select operators and define filter expressions, refer to the online Help within Microsoft SQL Server Management Studio.

For user-defined hierarchies, in which multiple members can be specified in the filter expression, all the specified members must be at the same level and share the same parent. This restriction does not apply to parent-child hierarchies.

1. Click the AssistButton next to the Dimension column of the Filter pane and then select the Sales Invoice Line Type dimension from the list.

2. Click the AssistButton next to the Hierarchy column and select Description from the list.

3. Click the AssistButton next to the Operator column and select Equal.

4. Click the AssistButton next to the Filter Expression column and select Item from the list.

FIGURE 4.7 A FILTER IS SET

Working with Data

The data displayed in the pivot table can be manipulated in many ways to suit the analysis you want to perform.

Drilling Down into a Member

To drill-down to a particular member, click the plus sign (+) next to the member or double-click the member.

Slicing Through Cube Dimensions 1. To filter the cube data, click the drop-down button on the top-level

column heading. 2. Expand the hierarchy and select or clear a member on any level to

show or hide it and all its descendants. 3. Clear the check box next to (All) to clear all the members in the

hierarchy. 4. After setting a filter on dimensions, toggle it on or off by right-

clicking anywhere in the Data pane and selecting Auto Filter. 5. Drag the Currency dimensions to the Drop Filter Fields Here area

in the Data pane.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 10: Na2009 enus biip_04

Business Intelligence for IT Professionals in Microsoft Dynamics® NAV 2009

4-10

6. Click the drop-down button on the top-level column heading and select n/a (the one between MZM and NGN) to have the Data pane display the items from transactions only with the local currency.

NOTE: In Microsoft Dynamics NAV, there is a blank value used for the local currency. In Microsoft SQL Server Management Studio, the blank values are replaced with n/a.

FIGURE 4.8 THE DATA IS FILTERED BY LOCAL CURRENCY

NOTE: Totals and subtotals in the pivot table shown in the preceding illustration above are calculated incorrectly, because the program sums up the values that must not be summed up. Refer to the Removing Totals and Subtotals section in this chapter on information how to address this issue.

To remove the filters and restore all the data, right-click anywhere in the Data pane and then select Auto Filter.

Viewing Member Properties and Cube Cell Information

To view information about a dimension object or cell value, hold the cursor over the cell until a pop-up window appears.

Showing or Hiding Empty Cells

To hide empty cells in the data grid, right-click anywhere in the Data pane and then click Show Empty Cells.

Removing Totals and Subtotals

Sometimes the totals and/or subtotals calculated in the Data pane are incorrect, because they sum up values that must not be totaled. For example, totals can be calculated for a column displaying the item price. To avoid this problem, hide the totals and the subtotals from the Data pane.

1. In the Data pane, right-click the Customer column and clear the check mark next to Subtotal.

2. Repeat step 1 above for the Sales Invoice Line No_ column.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 11: Na2009 enus biip_04

Chapter 4: Processing Cubes in Analysis Services Using Microsoft SQL Server Management Studio

4-11

The pivot table displaying data ready for a business intelligence analysis looks like the following.

FIGURE 4.9 THE PIVOT TABLE WITH DATA WITHOUT SUBTOTALS

Summary Microsoft SQL Server Management Studio is a powerful tool used to perform a business intelligence analysis. The tool has a browser that allows manipulating cube data in the context of various dimensions. Data can be displayed in a pivot table, and it can be grouped and filtered in numerous ways. The use of this tool allows IT Professionals to manage data configured in Microsoft Dynamics NAV for business intelligence purposes.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 12: Na2009 enus biip_04

Business Intelligence for IT Professionals in Microsoft Dynamics® NAV 2009

4-12

Test Your Knowledge

1. What data model is used by developers to provide a bridge between the user and data sources in Microsoft SQL Server Analysis Services?

2. Which function in the context menu is used to restore the filtered data in the Data pane?

( ) Undo ( ) Restore ( ) Auto Filter ( ) Show Empty Cells

3. How are blank values of the Microsoft Dynamics NAV fields displayed in Microsoft SQL Server Management Studio when they are members of the cube dimensions?

( ) Blank ( ) n/a ( ) Empty ( ) No_Value

4. What can be set up in the Filter pane for dimensions and their hierarchies to restrict the data displayed in the Data pane? (Select all that apply)

( ) Operators ( ) Criteria ( ) Measures ( ) Filter Expressions

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 13: Na2009 enus biip_04

Chapter 4: Processing Cubes in Analysis Services Using Microsoft SQL Server Management Studio

4-13

Lab 4.1 - Browsing a Cube in Microsoft SQL Server Management Studio

In this lab, you will practice browsing cubes and manipulating data in Microsoft SQL Server Management Studio. Use the Liquidity cube configured in the lab scenario of Chapter 3, "Configuring a BA Database in Microsoft Dynamics NAV."

Scenario

Kevin, the Sales Manager, wants to analyze the liquid ratio by measuring the liquidity and ability of his company to meet its obligations on a national scale. Meaning, Kevin wants to analyze whether the receivables from the domestic debtors can cover the payables to the domestic creditors.

Challenge Yourself! 1. Browse the Liquidity cube. 2. Build a pivot table using measures and dimensions of the Liquidity

cube. 3. Set filters to restrict the data displayed in the pivot table.

Need a Little Help?

1. Expand the Trade Analysis database in the Object Explorer of Microsoft SQL Server Management Studio and browse the Liquidity cube.

2. Add the Amount _LCY_C (to view the amount for sold items) and Amount _LCY_V (to view the amount for purchased items) measures to the Data pane.

3. Add the Posting Date and Gen_ Business Posting Group dimensions to the Data pane.

4. Set filters by the Customer Entry Type and Vendor Entry Type dimensions in the Filter pane.

Step by Step

1. In the Microsoft SQL Server Management Studio window, connect to Analysis Services.

2. In the Object Explorer, expand Databases > Trade Analysis > Cubes.

3. Right-click the Liquidity cube and select Browse. 4. Drag the Amount _LCY_C measure from the

DetailedCust_Ledg_Entry measure group in the Metadata pane to the details area of the Data pane.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 14: Na2009 enus biip_04

Business Intelligence for IT Professionals in Microsoft Dynamics® NAV 2009

4-14

5. Drag the Amount _LCY_V measure from the DetailedVendor_Ledg_Entry measures group in the Metadata pane to the details area of the Data pane.

6. Drag the Posting Date (Year; Quarter) dimension to the Drop Column Filter Here area in the Data pane.

7. Drag the Gen_ Business Posting Group dimension to the Drop Row Filter Here area in the Data pane.

8. In the Filter pane, click the AssistButton next to the Dimension column and select Customer Entry Type from the list.

9. Click the AssistButton next to the Hierarchy column and select Description from the list.

10. Click the AssistButton next to the Operator column and select Equal.

11. Click the AssistButton next to the Filter Expression column and select Initial Entry from the list.

12. Click the AssistButton next to the Dimension column and select Vendor Entry Type from the list.

13. Click the AssistButton next to the Hierarchy column and select Description from the list.

14. Click the AssistButton next to the Operator column and select Equal.

15. Click the AssistButton next to the Filter Expression column and select Initial Entry from the list.

The resulting pivot table looks like the following screenshot:

FIGURE 4.10 THE PIVOT TABLE READY FOR A BUSINESS INTELLIGENCE ANALYSIS

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 15: Na2009 enus biip_04

Chapter 4: Processing Cubes in Analysis Services Using Microsoft SQL Server Management Studio

4-15

Quick Interaction: Lessons Learned Take a moment and write down three Key Points you have learned from this chapter

1.

2.

3.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Page 16: Na2009 enus biip_04

Business Intelligence for IT Professionals in Microsoft Dynamics® NAV 2009

4-16

Solutions Test Your Knowledge

1. What data model is used by developers to provide a bridge between the user and data sources in Microsoft SQL Server Analysis Services?

MODEL ANSWER:

Unified Dimensional Model (UDM)

2. Which function in the context menu is used to restore the filtered data in the Data pane?

( ) Undo ( ) Restore (•) Auto Filter ( ) Show Empty Cells

3. How are blank values of the Microsoft Dynamics NAV fields displayed in Microsoft SQL Server Management Studio when they are members of the cube dimensions?

( ) Blank (•) n/a ( ) Empty ( ) No_Value

4. What can be set up in the Filter pane for dimensions and their hierarchies to restrict the data displayed in the Data pane? (Select all that apply)

(√) Operators ( ) Criteria ( ) Measures (√) Filter Expressions

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement