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 Jun 2, 2003

MDX Essentials: MDX Member Functions: "Relative" Member Functions

By William Pearson

About the Series ...

This is the eighth article of the series, MDX Essentials. The primary focus of this series is an introduction to MDX. The series is designed to provide hands-on application of the fundamentals of the Multidimensional Expressions (MDX) language, with each tutorial progressively adding features designed to meet specific real-world needs.

For more information about the series in general, as well as the software and systems requirements needed for getting the most out of the lessons included, please see the first article, MDX at First Glance: Introduction to MDX Essentials.

Note: Service Pack 3 updates are assumed for MSSQL Server 2000, MSSQL Server 2000 Analysis Services, and the related Books Online and Samples.

What We Accomplished in our Last Article

In the seventh article of the series, MDX Member Functions: The Cousin () Function, we explored the Cousin() function, concluding a set of articles where we examined what I call the "family" set of functions. We discussed the Cousin() function in detail, illustrated the syntax that is appropriate for its effective use, and then tested our understanding of how to leverage this remaining "family" function by undertaking relevant practice exercises. Finally, for each practice exercise, we commented on the results we obtained using the Cousin() function, and discussed some of the limitations that are inherent in its use.

In this lesson, we will begin an overview of additional "relative" member functions, expanding upon our earlier exposure to the powerful member functions, and then extending our exploration to the .CurrentMember, .PrevMember and .NextMember functions. As a part of our examination of these functions, we will introduce calculated members briefly as an avenue to demonstrating the use of the "relative" member functions. We will take up calculated members in far more detail as the series progresses, but, for now, we will preview their characteristics and dive right into using them.


In the last group of articles, we have worked with members, which we now know to be generally defined as any attribute that belongs to a dimension. In the Time dimensions we have examined in the last three articles specifically, for example, as a basis for our examination of several "family" functions, we recall that Year and Quarter existed as levels. We could, in our example, say that 1998 and Q3 are, therefore, members of the Time dimension. We used our examples to demonstrate the workings and characteristics of member functions, which, as we discovered, return another dimension member or a zero (an example of a scenario with a zero result would be the use of the .Parent function with a top level member -- who is parentless, as was the case in one of our examples). The "family" member functions allowed us to travel the dimensional hierarchy, as we witnessed in numerous examples, based upon the relative position of a given "family" member to the member matching the hierarchical relationship specified in the function.

We will next examine other, far more common "relative" member functions. Our lesson will include an introduction to the .CurrentMember, .PrevMember and .NextMember functions, with:

  • an examination of the syntax surrounding the use of each;
  • an illustrative example of the use of each in a practice exercise;
  • a brief discussion of the MDX results we obtain in each practice example;
  • a preliminary overview of calculated members, primarily to bring them "into the fold" of our growing MDX knowledgebase, and to initially make them available as a means of exploring the relative member functions of this lesson, as well as many MDX components in future articles.

Let's introduce calculated members now, and begin our examination of the "relative" member functions shortly after.

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