Chapter 45. Programming MDX Queries

In This Chapter

  • Cube addressing basics

  • MDX SELECT statements

  • Commonly used MDX functions

  • MDX named sets and calculated members

  • Adding named sets, calculated members, and business intelligence to cube definitions

MDX, or Multidimensional Expressions, is to Analysis Services what SQL is to the relational database, providing both definition (DDL) and query (DML) capabilities. MDX queries even look somewhat like SQL, but the ideas behind them are dramatically different. Certainly, MDX returns multidimensional cell sets instead of two-dimensional result sets, but more important, MDX does not contain a JOIN statement, as the cube contains explicit relationships between all the data it summarizes. Instead, hierarchically organized dimension data is manipulated in sets to determine both the content and structure of the result.

Learning to write basic MDX queries goes quickly for most students, especially those with other database experience. However, many beginners have a tendency to stall at the basic query level. This learning plateau seems to stem from a lack of understanding of only a dozen or so terms and concepts. These are the same concepts presented at the beginning of this chapter: tuples, sets, the parts of a dimension, and so on.

Avoid getting stalled by attacking MDX in manageable bites:

  1. Read the "Basic Select Query" section at the beginning of this chapter, followed by practicing basic queries until you become comfortable with them.

  2. Return to and reread ...

Get SQL Server™ 2005 Bible now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.