共用方式為


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 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]

請參閱

參考