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

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

News Via RSS Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles


Posted Jun 24, 2003

MDX in Analysis Services: Retrieve Data from Multiple Cubes - Page 2

By William Pearson

Extending Our MDX Expressions: Retrieving Data from a Second Cube

In this preliminary exercise, we will examine how we can use MDX to retrieve a value from a second cube, offering us the capability of using multiple OLAP data sources together for analysis and reporting. In addition, we will demonstrate how we can compute a per unit average, within the context of providing a Revenue per Unit Sold value based upon values retrieved from two separate OLAP data sources. We will perform exercises to reinforce these concepts within the context of our OLAP data sources.

To prepare for the lesson, let's open Analysis Manager, and create a new calculated member within the Budget cube.

From the Analysis Manager console, and at the Cubes folder within the FoodMart 2000 database sample:

1.      Expand the Cubes folder (seen in the illustration below), by clicking the "+" sign to its left.

Illustration 1: Sample Cubes provided with the Analysis Services Installation

2.      Right-click the Budget cube.

3.      Click Edit from the flyout context menu.

4.      When the Cube Editor screen appears, click the Data tab at its lower left (Data Viewing pane).

The Data Viewing pane is activated, retrieving the view that was last saved, or perhaps the default, if none was saved from previous lessons.

5.      Drag the Store dimension from the top pane down to the current dimension in the Rows axis (you can drop the icon that appears over the heading currently in place - a small, double-headed arrow appears at the "drop" point), to "swap" the current dimension to the top and Store below (it will appear as Store Country, the level of the Store dimension above All Stores (the top level), in the current dimension's old place).

6.      Drag the Measures dimension from the top pane down to replace the dimension in the Columns axis, unless it is already there. The heading will appear as MeasuresLevel, with the measure Amount appearing just underneath.

7.      Select 1997, if necessary, in the filter field for the Year dimension atop the Data Viewing pane.

The Data Viewing pane now appears as shown below:

Illustration 2: The Data Viewing Pane after our Dimension "Swap" (Compressed View)

Our first focus will be to retrieve the Sales Units data from the Sales cube (another sample cube that comes along with the Analysis Services installation). To create a calculated member to accomplish this, we will use a "lookup" function. We will take the following steps to proceed:

8.      Click the filter field for the Account dimension, and, from the dropdown hierarchy that appears, click the "+" signs continually to expand to, and select, Gross Sales, as shown in Illustration 3.

Illustration 3: Select Gross Sales as the Filter

9.      Double-click the USA member of the Store Country level (Rows axis) to explode to the USA Store State view of the Store dimension for USA.

The result set should be identical to that shown in Illustration 4.

Illustration 4: The Results in the Data Viewing Pane

We notice that the Budget cube contains data for USA Stores only.

MS SQL Archives

Comment and Contribute


(Maximum characters: 1200). You have characters left.



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