返回由数值或字符串表达式指定的层级结构。
Syntax
Numeric expression syntax
Dimensions(Hierarchy_Number)
String expression syntax
Dimensions(Hierarchy_Name)
Arguments
Hierarchy_Number
一个有效的数值表达式,用于指定层级数。
Hierarchy_Name
一个指定的层级名称的有效字符串表达式
Remarks
如果指定了层级编号, 维度 函数返回一个层级,其在立方体内以零为基础的位置指定了层级编号。
如果指定了层级名称, Dimensions 函数返回指定的层级。 通常,你会用这个字符串版本的 维度 函数来配合用户自定义函数。
注释
度量维度总是用 Dimensions(0)表示。
示例
以下示例使用 维度 函数返回指定层级的名称、层数和成员数,使用数值表达式和字符串表达式。
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]