Dimensions (MDX)
返回数值表达式或字符串表达式指定的层次结构。
语法
Numeric expression syntax
Dimensions(Hierarchy_Number)
String expression syntax
Dimensions(Hierarchy_Name)
参数
Hierarchy_Number
指定层次结构号的有效数值表达式。Hierarchy_Name
指定层次结构名称的有效字符串表达式。
注释
如果指定了层次结构号,则 Dimensions 函数返回一个层次结构,该层次结构在多维数据集中以零为基的位置就是指定的层次结构号。
如果指定了层次结构的名称,则 Dimensions 函数返回指定的层次结构。 通常情况下,这个字符串版本的 Dimensions 函数与用户定义的函数一起使用。
备注
Measures 维度始终由 Dimensions(0) 表示。
示例
下例使用 Dimensions 函数连同一个数值表达式和一个字符串表达式,返回指定层次结构的名称、级别计数和成员计数。
WITH MEMBER Measures.x AS Dimensions
('[Product].[Product Model Lines]').Name
SELECT Measures.x on 0
FROM [Adventure Works]
WITH MEMBER Measures.x AS Dimensions
('[Product].[Product Model Lines]').Levels.Count
SELECT Measures.x on 0
FROM [Adventure Works]
WITH MEMBER Measures.x AS Dimensions
('[Product].[Product Model Lines]').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]