Chapter 5. Named Sets and Set Aliases

Building and using sets is an important part of MDX. Sometimes, it is most convenient to attach a name to a set that you've defined so that you can reference it later. As introduced in Chapter 2, standard MDX provides named sets to do just that. Both Analysis Services and Essbase extend the standard with set aliases to provide names for sets in additional contexts. (Essbase further provides tuple aliases as well.) These are also easy to use and frequently used.

The first half of this chapter builds on Chapter 4's discussion of context and execution flow to add detail to named set evaluation and use. The second half of this chapter introduces some rather involved query requirements that are solved by only a small number of features and functions working together. It both explains how some sophisticated user requests are handled and also continues to work through constructing MDX as assemblies of small simple expressions, so it may bear reading slowly and more than once.

Named Sets: Scopes and Context

Chapter 4 discussed context and query evaluation at some length. To recap briefly here, when a query is evaluated, first the slicer is evaluated, and then named sets are evaluated. This means that the slicer forms the context for all calculations performed in evaluating a named set. So, for named sets defined in the WITH section, you can make named set logic generic by relying on the slicer, or you can make it specific by adding particular members to ...

Get MDX Solutions: With Microsoft® SQL Server™ Analysis Services 2005 and Hyperion® Essbase, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.