Dimensions (MDX)
傳回由數值或字串運算式所指定的階層。
語法
Numeric expression syntax
Dimensions(Hierarchy_Number)
String expression syntax
Dimensions(Hierarchy_Name)
引數
Hierarchy_Number
指定階層編號的有效數值運算式。Hierarchy_Name
指定階層名稱的有效字串運算式。
備註
如果指定階層編號,Dimensions 函數會傳回一個階層,該階層在 Cube 內以零為基底的位置就是指定的階層編號。
如果指定階層名稱,Dimensions 函數會傳回指定的階層。一般來說,這個 Dimensions 函數的字串版本可與使用者自訂函數搭配使用。
[!附註]
Measures 維度永遠是由 Dimensions(0) 代表。
範例
下列範例使用 Dimensions 函數來傳回指定階層的名稱、層級計數及成員計數 (範例中使用數值運算式和字串運算式)。
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]