Export (0) Print
Expand All

SELECT Statement (MDX)

Updated: 17 July 2006

Retrieves data from a specified cube.


[ WITH <SELECT WITH clause> 
   [ , <SELECT WITH clause>...n ] 
] 
SELECT 
     [ * 
    | ( <SELECT query axis clause> 
                  [ , <SELECT query axis clause>,...n ] 
            ) 
            ]
FROM 
   <SELECT subcube clause> 
      [ <SELECT slicer axis clause> ]
      [ <SELECT cell property list clause> ]

<SELECT WITH clause> ::=
     ( CELL CALCULATION <CREATE CELL CALCULATION body clause> ) 
   | ( [ CALCULATED ] MEMBER <CREATE MEMBER body clause>) 
   | ( SET <CREATE SET body clause>)

<SELECT query axis clause> ::=
   [ NON EMPTY ] Set_Expression
   [ <SELECT dimension property list clause> ] 
      ON 
            Integer_Expression 
       | AXIS(Integer) 
       | COLUMNS 
       | ROWS 
       | PAGES 
       | SECTIONS 
       | CHAPTERS 

<SELECT subcube clause> ::=
      Cube_Name 
   | (SELECT 
                  [ * 
       | ( <SELECT query axis clause> [ , 
           <SELECT query axis clause>,...n ] ) 
         ] 
            FROM 
         <SELECT subcube clause> 
         <SELECT slicer axis clause> )

<SELECT slicer axis clause> ::= 
      WHERE Tuple_Expression

<SELECT cell property list clause> ::= 
   [ CELL ] PROPERTIES CellProperty_Name 
      [ , CellProperty_Name,...n ]

<SELECT dimension property list clause> ::=
   [DIMENSION] PROPERTIES 
      (DimensionProperty_Name 
         [,DimensionProperty_Name,...n ] ) 
    | (LevelProperty_Name 
         [, LevelProperty_Name,...n ] ) 
    | (MemberProperty_Name 
         [, MemberProperty_Name,...n ] )

Set_Expression

A valid Multidimensional Expressions (MDX) expression that returns a set.

Integer

An integer between 0 and 127.

Cube_Name

A valid string that provides a cube name.

Tuple_Expression

A valid Multidimensional Expressions (MDX) expression that returns a tuple.

CellProperty_Name

A valid string that represents a cell property.

DimensionProperty_Name

A valid string that represents a dimension property.

LevelProperty_Name

A valid string that represents a level property.

MemberProperty_Name

A valid string that represents a member property.

The <SELECT slicer axis clause> expression must contain members in dimensions and hierarchies other than those referenced in the specified <SELECT query axis clause> expressions.

If an attribute in the cube is omitted from the specified <SELECT query axis clause> expressions and the <SELECT slicer axis clause> value, the attribute's default member is implicitly added to the slicer axis.

Example

The following example returns the sum of the Measures.[Order Quantity] member, aggregated over the first eight months of calendar year 2003 that are contained in the Date dimension, from the Adventure Works cube.

WITH MEMBER [Date].[Calendar].[First8Months2003] AS
    Aggregate(
        PeriodsToDate(
            [Date].[Calendar].[Calendar Year], 
            [Date].[Calendar].[Month].[August 2003]
        )
    )
SELECT 
    [Date].[Calendar].[First8Months2003] ON COLUMNS,
    [Product].[Category].Children ON ROWS
FROM
    [Adventure Works]
WHERE
    [Measures].[Order Quantity]

Release History

17 July 2006

Changed content:
  • Updated syntax and arguments to improve clarity.
  • Added updated examples.

Community Additions

ADD
Show:
© 2014 Microsoft