O'Reilly logo

Microsoft® SQL Server® 2008 MDX Step by Step by C Ryan Clay Bryan C Smith and Hitachi Consulting

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Performing Advanced Set Construction

The MDX language provides access to some powerful if somewhat esoteric functions for building complex sets. In this final section of the chapter, you take a look at how two of these functions, Generate and Extract, can help you address common challenges.

Assembling Sets with the Generate Function

If you’ve worked with a procedural language such as C# or Visual Basic, you are familiar with the concept of a For Each loop. With a For Each loop, you iterate over the objects in a collection. For each of these objects, some operation is performed. Substitute a set of tuples for the collection of objects, use a set-building expression for the operations, and you’ve got the basic idea behind the Generate function:

Generate( ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required