Export (0) Print
Expand All
Avg
IIf
Lag
Max
Min
Mtd
Qtd
Sum
Var
Wtd
Ytd
Collapse the table of content
Expand the table of content
Expand Minimize

Dimensions (MDX)

Updated: 17 July 2006

Returns a hierarchy specified by a numeric or string expression.


Numeric expression syntax
Dimensions(Hierarchy_Number)

String expression syntax
Dimensions(Hierarchy_Name)

Hierarchy_Number

A valid numeric expression that specifies a hierarchy number.

Hierarchy_Name

A valid string expression that specifies a hierarchy name

If a hierarchy number is specified, the Dimensions function returns a hierarchy whose zero-based position within the cube is specified hierarchy number.

If a hierarchy name is specified, the Dimensions function returns the specified hierarchy. Typically, you use this string version of the Dimensions function with user-defined functions.

ms145511.note(en-US,SQL.90).gifNote:
The Measures dimension is always represented by Dimensions(0).

Examples

The following examples use the Dimensions function to return the name, count of levels, and count of members of a specified hierarchy, using both a numeric expression and a string expression.

WITH MEMBER Measures.x AS Dimensions
   ('[Product].[Product Model Categories]').Name
SELECT Measures.x on 0
FROM [Adventure Works]

WITH MEMBER Measures.x AS Dimensions
   ('[Product].[Product Model Categories]').Levels.Count
SELECT Measures.x on 0
FROM [Adventure Works]

WITH MEMBER Measures.x AS Dimensions
   ('[Product].[Product Model Categories]').Members.Count
SELECT Measures.x on 0
FROM [Adventure Works]

WITH MEMBER Measures.x AS Dimensions(0).Name
SELECT Measures.x on 0
FROM [Adventure Works]

WITH MEMBER Measures.x AS Dimensions(0).Levels.Count
SELECT measures.x on 0
FROM [Adventure Works]

WITH MEMBER Measures.x AS Dimensions(0).Members.Count
SELECT measures.x on 0
FROM [Adventure Works]

Release History

17 July 2006

Changed content:
  • Updated syntax and arguments to improve clarity.
  • Added updated examples.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2015 Microsoft