2015-02-11 94 views
0

我需要的東西如下:創建MDX的度量一組成員

with member Measures.Test2 as (Measures.Test, {[Assets Monthly].[Disbursed Date].&[2014], [Assets Monthly].[Disbursed Date].&[2015]}) 
select Measures.Test2 on columns 
from databaseX 

它只能如果我只有一個成員,前設置:

with member Measures.Test2 as (Measures.Test, [Assets Monthly].[Disbursed Date].&[2014]) 

的錯誤我得到的第一種情況是:

函數需要 參數的字符串或數字表達式。使用元組集表達式。

回答

1

反對AdvWrks

WITH 
    MEMBER Measures.Test2 AS 
    Sum 
    (
     { 
     [Date].[Calendar].[Calendar Year].&[2006] 
     ,[Date].[Calendar].[Calendar Year].&[2007] 
     } 
    ,[Measures].[Internet Sales Amount] 
    ) 
SELECT 
    Measures.Test2 ON COLUMNS 
FROM [Adventure Works]; 

您的腳本:

WITH 
    MEMBER Measures.Test2 AS 
    Sum 
    (
     { 
     [Assets Monthly].[Disbursed Date].&[2014] 
     ,[Assets Monthly].[Disbursed Date].&[2015] 
     } 
    ,Measures.Test 
    ) 
SELECT 
    Measures.Test2 ON COLUMNS 
FROM databaseX; 

這是漂亮。在日期層次結構上創建一個計算成員,並在WHERE切片器中查看度量值:

WITH 
    MEMBER [Date].[Calendar].[testPeriod] AS 
    Aggregate 
    (
     { 
     [Date].[Calendar].[Calendar Year].&[2006] 
     ,[Date].[Calendar].[Calendar Year].&[2007] 
     } 
    ) 
SELECT 
    [Date].[Calendar].[testPeriod] ON COLUMNS 
FROM [Adventure Works] 
WHERE 
    [Measures].[Internet Sales Amount];