我有一个MDX查询,如;
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 :(得分: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