2013-02-12 64 views
0

我很努力與這個MDX行上應該返回日期和價值國家排序的交叉。顯然,在交叉連接期間Order函數中的[Date] .CurrentMember仍然返回默認成員,而不是交叉連接上下文中的當前成員。也許我的理解如何和什麼時候在crossjoin期間設置評估是不正確的?MDX:Crossjoin和設置評估

WITH 
    SET [DATE_main] AS 
    { 
     [Date].[Fiscal Year].&[2002], 
     [Date].[Fiscal Year].&[2003] 
    } 
    SET [CUSTOMER_ordered] AS 
    { 
     Order 
     (
     [Customer].[Customer Geography].[Country].Members, 
     (
      [Customer].[Customer Geography].CurrentMember, 
      [Date].[Fiscal Year].CurrentMember, 
      [Measures].[Internet Sales Amount] 
     ), 
     BDESC 
    ) 
    } 
SELECT 
    {[Measures].[Internet Sales Amount]} ON COLUMNS, 
    CrossJoin 
    (
    [DATE_main], 
    [CUSTOMER_ordered] 
) ON ROWS 
FROM [Adventure Works]; 

感謝您的任何建議, Endokr

回答

0

有預期的結果,你必須把交叉連接的順序內。

+0

我忘了提,我需要[ (2002年,澳大利亞),(2002年,加拿大),(2003年,澳大利亞),(2003年,加拿大)等等,基本上需要根據每個[DATE_main ]成員。 – Endokr 2013-02-13 08:50:36

0

這解決我的問題,但我還是想知道爲什麼[日期]如我所料在CROSSJOIN [財政年度] .CurrentMember不起作用:

WITH 
    SET [DATE_main] AS 
    { 
     [Date].[Fiscal Year].&[2002], 
     [Date].[Fiscal Year].&[2003] 
    } 
    SET [CUSTOMER_ordered] AS 
    { 
     Order 
     (
     [Customer].[Customer Geography].[Country].MEMBERS, 
     (
      [Customer].[Customer Geography].CurrentMember, 
      [Date].[Fiscal Year].CurrentMember, 
      [Measures].[Internet Sales Amount] 
     ), 
     BDESC 
    ) 
    } 
SELECT 
    {[Measures].[Internet Sales Amount]} ON COLUMNS, 
    Generate 
    (
    [DATE_main], 
    Order 
    (
     CrossJoin 
     (
     [Date].[Fiscal Year].CurrentMember, 
     [Customer].[Customer Geography].[Country].MEMBERS 
    ), 
     (
     [Measures].[Internet Sales Amount] 
    ), 
     BDESC 
    ) 
) ON ROWS 
FROM [Adventure Works];