Multidimensional Expressions (MDX) and Datasets

After establishing a connection and getting an interface on the session object, the consumer has to specify a query. Execution of a query results in a dataset. All data in a multidimensional data source exists as value points in one or more n-dimensional cubes. The result of a user query encompasses one or more cubes, and extracts a set of points from these cubes as another p-dimensional cube. The value of p is usually no more than 4 and is typically 2 or 3. The resulting p-dimensional cube is called a dataset. This is similar to a query in a relational database system where the query encompasses one or more tables and returns a result set that has the same structure as that of a table.

The dataset itself looks like a cube, but the “dimensions” of the dataset are called axes. Each axis consists of one or more dimensions projected on it. For a more complete description of the dataset, see “Datasets.”

OLE DB for OLAP defines a rich syntax for specifying a dataset, called Multidimensional Expressions (MDX). This can be viewed as a set of macros defined on top of the SQL language. Although these macros are generally useful for querying an OLAP data source, their precise semantics are defined by means of their SQL language mappings.

The following sections discuss concepts of MDX and provide examples of its use.