About the Series …
This is the sixteenth article of the series, MDX Essentials. 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 last article of the series, Basic Set Functions: The Except() Function, we explored the useful Except() function, whose purpose is to return the difference between two sets. In addition to discussing the purpose and operation of the Except() function, we focused on the treatment of duplicates by the function. We examined the syntax surrounding its uses, and illustrated its application in practice exercises, providing hands-on exposure to the use of Except().
We first undertook a multi-step example in which we exposed default handling of duplicates by the function, then explored an additional example where we practiced the use of the ALL flag to override the Except() function’s default duplicate handling. Throughout the practice exercises, we discussed the results we obtained with each step’s execution, remarking on the distinguishing characteristics of optional flag settings.
Introduction
In this lesson, we will expose what many consider one of the most useful functions in the MDX arsenal, the Filter() function. The general purpose of the Filter() function is to allow us to filter out parts of a set that we do not need in a given situation, and to return a subset of a larger set as a result. Uses of the Filter() function, as with many MDX functions, can range from the sublimely simple to the impressively advanced, and it can be used in many innovative ways. The objective, of course, is the support of precise analysis to meet our business needs. We will see in this article how the Filter() function is a prime example of the efficiency and precision we can attain by using judiciously chosen functions from our MDX toolsets.
Along with an introduction to the Filter() function, this lesson will include:
- an examination of the syntax surrounding the function;
- illustrative examples of the uses of the function in practice exercises;
- a brief discussion of the MDX results we obtain in the practice examples.