# MDX Essentials: Member Functions: More "Family" Functions

April 21, 2003

### About the Series ...

This is the sixth 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 fifth article of the series, MDX Member Functions: The "Family" Functions, we exposed three member functions that belong to a group to which I often refer as the "family" functions: .Parent, .Children and Ancestor(). We discussed the information that these functions return, and covered syntactical points surrounding their use. We illustrated how to take advantage of these useful functions by performing practice exercises, and then commented on the result datasets we obtained.

Our last lesson served as the second session within our Member Functions group of articles. In this lesson, we continue our examination of the member functions and operators, one at a time, contrasting the uses and characteristics of each. Specifically, we will expose the .FirstChild, .LastChild, .FirstSibling and .LastSibling functions, considering their output and the syntax applicable to some of their uses. We will practice putting these valuable functions to work by undertaking practice exercises, and then we will examine the datasets that are returned in each case.

### Introducing More "Family" Member Functions

We took a moment to "get to know the family" (in my meaning of the term "family functions"), stating that the functions and operators that compose this group (for the purposes of this set of articles) include:

• .Parent
• .Children
• Ancestor()
• Cousin()
• .FirstChild
• .LastChild
• .FirstSibling
• .LastSibling

We mentioned that the "family" metaphor is appropriate to this group, because these functions perform operations on dimensions, hierarchies, and levels in a manner that simulates movement about a "family tree." As we stated in our last article, our focus in this segment of the series is primarily the member functions, although other "family"-like functions are available that return sets.

This lesson will include:

• An introduction to the .FirstChild, .LastChild, .FirstSibling and .LastSibling functions, with
• an examination of the syntax that surrounds each function's use;
• an illustrative example of its use in a practice exercise;
• a brief discussion of the MDX results we obtain in the practice example.
• Further examination of the WHERE clause, and its specification of slicer dimensions;
• Illustrations of the use of combinations of the "family" functions;
• An examination of the use of the NON EMPTY keywords to suppress empty intersects from our result sets;

As we discussed in Lesson 5, many member functions, particularly those of the "family" group, allow us to perform operations based upon a member's relative position, either up ("above" the member upon which the function is being performed) or down ("below" the member upon which the function is being performed) a dimensional hierarchy. Like most member functions, the "family" functions can be quite valuable in helping us to make our MDX queries simpler and more compact.