MDX Essentials: Member Functions: More “Family” Functions

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.

William Pearson
William Pearson
Bill has been working with computers since before becoming a "big eight" CPA, after which he carried his growing information systems knowledge into management accounting, internal auditing, and various capacities of controllership. Bill entered the world of databases and financial systems when he became a consultant for CODA-Financials, a U.K. - based software company that hired only CPA's as application consultants to implement and maintain its integrated financial database - one of the most conceptually powerful, even in his current assessment, to have emerged. At CODA Bill deployed financial databases and business intelligence systems for many global clients. Working with SQL Server, Oracle, Sybase and Informix, and focusing on MSSQL Server, Bill created Island Technologies Inc. in 1997, and has developed a large and diverse customer base over the years since. Bill's background as a CPA, Internal Auditor and Management Accountant enable him to provide value to clients as a liaison between Accounting / Finance and Information Services. Moreover, as a Certified Information Technology Professional (CITP) - a Certified Public Accountant recognized for his or her unique ability to provide business insight by leveraging knowledge of information relationships and supporting technologies - Bill offers his clients the CPA's perspective and ability to understand the complicated business implications and risks associated with technology. From this perspective, he helps them to effectively manage information while ensuring the data's reliability, security, accessibility and relevance. Bill has implemented enterprise business intelligence systems over the years for many Fortune 500 companies, focusing his practice (since the advent of MSSQL Server 2000) upon the integrated Microsoft business intelligence solution. He leverages his years of experience with other enterprise OLAP and reporting applications (Cognos, Business Objects, Crystal, and others) in regular conversions of these once-dominant applications to the Microsoft BI stack. Bill believes it is easier to teach technical skills to people with non-technical training than vice-versa, and he constantly seeks ways to graft new technology into the Accounting and Finance arenas. Bill was awarded Microsoft SQL Server MVP in 2009. Hobbies include advanced literature studies and occasional lectures, with recent concentration upon the works of William Faulkner, Henry James, Marcel Proust, James Joyce, Honoré de Balzac, and Charles Dickens. Other long-time interests have included the exploration of generative music sourced from database architecture.

Latest Articles