MDX Essentials: Basic Set Functions: The Intersect() Function

December 8, 2003

About the Series ...

This is the fourteenth 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 Union() Function, we explored the commonly used Union() function, whose purpose is to combine two sets into one. We discussed the function in general, along with the capabilities it affords us within MDX, emphasizing its value within our analysis toolsets.

In addition to discussing the purpose and operation of the Union() function, we examined both primary and alternate syntaxes involved in its use, illustrating the application of each in practice exercises. Focusing on the treatment of duplicates in each of the syntactical approaches, we discussed the results we obtained in each exercise, remarking on distinguishing characteristics of each.


In this lesson, we will focus our attention on a function that has some characteristics in common with the Union() function, yet produces a very different result. The rather simple purpose of the Intersect() function is to compare two sets, then to return a set that consists of members that exist in both original sets; that is, to return a mathematical set intersection of the sets specified in the function. Indirect uses of Intersect() are quite common, as well. Like the Union() function, the Intersect() function provides important capabilities within MDX, and is a valuable part of our analysis toolsets

Along with an introduction to the Intersect() 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.