維度 (MDX)
傳回數值或字串運算式所指定的階層。
語法
Numeric expression syntax
Dimensions(Hierarchy_Number)
String expression syntax
Dimensions(Hierarchy_Name)
引數
Hierarchy_Number
指定階層編號的有效數值運算式。
Hierarchy_Name
指定階層名稱的有效字串運算式
備註
如果指定了階層編號, Dimensions 函 式會傳回階層,其 Cube 內以零起始的位置是指定階層編號。
如果指定了階層名稱, Dimensions 函 式會傳回指定的階層。 一般而言,您可以使用這個字串版本的 Dimensions 函 式搭配使用者定義函式。
注意
量 值 維度一律以 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]