Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum Rss Feed

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
Free Newsletters:

News Via RSS Feed

Rss Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles


Posted Apr 17, 2003

MDX in Analysis Services: Intermediate Concepts - Part 1 - Page 7

By William Pearson

33.  Select Canada (under "All Stores") in the filter field for the Store dimension atop the Data Viewing pane. The pane appears as shown below.

Illustration 13: The Tuple Value Remains even with the Canada Filter

We see that MyCalcMem2 retains the tuple value of ([Account].[Net Income],[Store].[Store Country].[Mexico]), even when the Canada filter is in place, for the results set. This demonstrates clearly that the expression, and not the current member for the Store dimension, determines the context of the value.

Say we are presented with a requirement to quantify the difference in Net Income between Mexico and Canada stores. We can create an expression within our calculated member to calculate the difference and return the amount. This will provide an added illustration of the use of tuples from our cube, along with an appropriate operator, to build an expression to fit a simple business need.

34.  Select Value property for MyCalcMem2 once again.

35.  Click the ellipses button.

The Calculated Member Builder dialog appears.

36.  Type in the following into the Value Expression box:

([Account].[Net Income],[Store].[Store Country].[Mexico])-([Account].[Net Income],[Store].[Store Country].[Canada])

37.  Rename the Calculated Member "NAFTA Partners Difference" using the Member Name box in the dialog.

The Calculated Member Builder dialog appears as shown below.

Illustration 14: The Calculated Member Builder Dialog with Modifications

38.  Click OK to enact changes.

The Calculated Member Builder dialog closes, leaving the result set shown in Illustration 15.

Illustration 15: The New Expression Renders the Difference, as Expected

We see, when we determine the difference in this way, that the figure delivered by MDX (-761,869.84) indeed agrees with the independent calculation (the difference between -790,921.84 and -29,052.00). We obtain the difference regardless of the presence of conflicting filters in the top of the Data Viewing pane, because we have explicitly specified dimensions in our expression.

39.  Click File ` Exit from the top menu to leave the Cube Editor.

40.  Click No to abandon, or Yes to save, changes to the cube.

41.  Close Analysis Manager as desired by clicking Console ` Exit in the upper top menu.

Next in Our Series ...

In this tutorial, we took MDX beyond the retrieval of member names and properties, and began to focus on leveraging the capabilities of the language to return values from a multidimensional cube. We created calculated measures whose values were based upon a constant, then upon current members, and explored additional uses of calculated members and measures. We practiced returning values from cells based upon the specification of dimensions within MDX expressions, to extend the expressions' utility within the context of reporting from an OLAP data source. Moreover, we examined various aspects of the MDX notation system along the way.

Our next tutorial expands further the intermediate topics we introduced in this lesson. We will take on practice examples where we will delve into handling hierarchical relationships in our expressions. We will also discuss a way to identify empty members, and illustrate why this is important in building expressions.

» See All Articles by Columnist William E. Pearson, III

MS SQL Archives

Latest Forum Threads
MS SQL Forum
Topic By Replies Updated
SQL 2005: SSIS: Error using SQL Server credentials poverty 3 August 17th, 07:43 AM
Need help changing table contents nkawtg 1 August 17th, 03:02 AM
SQL Server Memory confifuration bhosalenarayan 2 August 14th, 05:33 AM
SQL Server Primary Key and a Unique Key katty.jonh 2 July 25th, 10:36 AM