Specifying the Contents of a Query Axis (MDX)

Query axes specify the edges of a cellset returned by a Multidimensional Expressions (MDX) SELECT statement. Specifying the edges of a cellset lets you restrict the returned data that is visible to the client.

To specify query axes, you use the <SELECT query axis clause> to assign a set to a particular query axis. Each <SELECT query axis clause> value defines one query axis. The number of axes in the dataset is equal to the number of <SELECT query axis clause> values in the SELECT statement.

Query Axis Syntax

The following syntax shows the syntax for the <SELECT query axis clause>:

<SELECT query axis clause> ::=
   [ NON EMPTY ] Set_Expression [ <SELECT dimension property list clause> ] 
   ON {
      Integer_Expression | 
      AXIS( Integer_Expression ) | 

Each query axis has a number: zero (0) for the x-axis, 1 for the y-axis, 2 for the z-axis, and so on. In the syntax for the <SELECT query axis clause>, the Integer_Expression value specifies the axis number. An MDX query can support up to 128 specified axes, but very few MDX queries will use more than 5 axes. For the first 5 axes, the aliases COLUMNS, ROWS, PAGES, SECTIONS, and CHAPTERS can instead be used.

An MDX query cannot skip query axes. That is, a query that includes one or more query axes must not exclude lower-numbered or intermediate axes. For example, a query cannot have a ROWS axis without a COLUMNS axis, or have COLUMNS and PAGES axes without a ROWS axis.

However, you can specify a SELECT clause without any axes (that is, an empty SELECT clause). In this case, all dimensions are slicer dimensions, and the MDX query selects one cell.

In the query axis syntax previously shown, each Set_Expression value specifies the set that defines the contents of the query axis. For more information about sets, see Working with Members, Tuples, and Sets (MDX).