2016-02-27 72 views
0

我有一个MDX查询,例如;跨用户定义层次结构的MDX Cross连接

with 
set [IcPiyasaCC] as 
     { 
     [DimCostCenterView].[CostCenterKey].&[S_EDT], 
     [DimCostCenterView].[CostCenterKey].&[S_END.MRG], 
     [DimCostCenterView].[CostCenterKey].&[S_GM_YRD], 
     [DimCostCenterView].[CostCenterKey].&[S_PER.RAF], 
     [DimCostCenterView].[CostCenterKey].&[S_ULUSAL], 
     [DimCostCenterView].[CostCenterKey].&[S_PAS_MARG] 
     } 
member [DimCostCenterView].[CostCenterKey].[IcPiyasa] as 
    aggregate([IcPiyasaCC]) 
SELECT 
    NON EMPTY 
    { 
    [Measures].[Fiili_TutarTonaj] 
    } ON COLUMNS, 
NON EMPTY 
    { 
    (
     [DimCostCenterView].[CostCenterKey].[IcPiyasa] 
    --*[DimCostCenterView].[CostCenterKey].[CostCenterKey].ALLMEMBERS 
    ) 
    } 
ON ROWS 

和我可以得到所需的输出像;

-   Fiili_TutarTonaj 
IcPiyasa   6 

但是当我尝试过用[DimCostCenterView].[CostCenterKey].[CostCenterKey].ALLMEMBERS这是对同一层级,让如有相关的“CostCenterKey” S,我得参加“CostCenterKey层次使用一次以上的CROSSJOIN功能。”错误信息。我怎么能交叉他们得到的结果像;

-   -    Fiili_TutarTonaj 
IcPiyasa S_EDT    1 
IcPiyasa S_END.MRG   2 
IcPiyasa S_ULUSAL   3 

谢谢。

回答

0

您可以将新聚合成员托管在不同的层次结构中。交叉连接,然后将有可能:

WITH 
SET [IcPiyasaCC] AS 
     { 
     [DimCostCenterView].[CostCenterKey].&[S_EDT], 
     [DimCostCenterView].[CostCenterKey].&[S_END.MRG], 
     [DimCostCenterView].[CostCenterKey].&[S_GM_YRD], 
     [DimCostCenterView].[CostCenterKey].&[S_PER.RAF], 
     [DimCostCenterView].[CostCenterKey].&[S_ULUSAL], 
     [DimCostCenterView].[CostCenterKey].&[S_PAS_MARG] 
     } 
MEMBER [Geography].[Geography].[All].[IcPiyasa] AS 
    AGGREGATE(
     [IcPiyasaCC], 
     ([Geography].[Geography].[All]) 
    ) 
SELECT 
    NON EMPTY 
    [Measures].[Fiili_TutarTonaj] ON 0, 
NON EMPTY 
     [Geography].[Geography].[All].[IcPiyasa] 
     *[DimCostCenterView].[CostCenterKey].[CostCenterKey].ALLMEMBERS 
    ON 1 
... 
... 

或者这样:

WITH 
SET [IcPiyasaCC] AS 
     { 
     [DimCostCenterView].[CostCenterKey].&[S_EDT], 
     [DimCostCenterView].[CostCenterKey].&[S_END.MRG], 
     [DimCostCenterView].[CostCenterKey].&[S_GM_YRD], 
     [DimCostCenterView].[CostCenterKey].&[S_PER.RAF], 
     [DimCostCenterView].[CostCenterKey].&[S_ULUSAL], 
     [DimCostCenterView].[CostCenterKey].&[S_PAS_MARG] 
     } 
MEMBER [Measures].[ForceName] AS 'IcPiyasaCC' 
MEMBER [Geography].[Geography].[All].[IcPiyasa] AS 
    (
     [Geography].[Geography].[All] 
     ,[Measures].[ForceName] 
    ) 
SELECT 
    NON EMPTY 
    [Measures].[Fiili_TutarTonaj] ON 0, 
NON EMPTY 
     [Geography].[Geography].[All].[IcPiyasa] 
     *[DimCostCenterView].[CostCenterKey].[CostCenterKey].ALLMEMBERS 
    ON 1 
+0

谢谢,但是当我使用[DimCostCenterView] [IcPiyasa] [IcPiyasa]这让我像找不到。 '[IcPiyasa]'层次解析时(我不能完全翻译错误信息,它是用我的母语)。我应该如何定义“成员” – bsaglamtimur

+0

您可以添加多维数据集结构的照片吗? – whytheq

+0

http://barbaros.blob.core.windows.net/cdn/Capture.PNG – bsaglamtimur