我有2个mdx查询:
SELECT
NON EMPTY { [Measures].[Sum of Sales_Value_USD], [Measures].[Sum of Sales_Value_USD Late] } ON COLUMNS,
NON EMPTY { ([DateDimension].[DATE_QUARTER].[DATE_QUARTER].ALLMEMBERS ) } ON ROWS
FROM [Model]
where
( [DateDimension].[CurrentQuarter].&[Yes], { [ProductLine].[ProductHierarchy]
.[Product_Level5].&[PP100 - Electric Solutions], [ProductLine].[ProductHierarchy].[Product_Level5].&[PP200 - Gas Solutions], [ProductLine].[ProductHierarchy]
.[Product_Level5].&[PP300 - Water Solutions] } , { [SalesHistory].[Status].&[BACKLOG]
, [SalesHistory].[Status].&[HISTORY] } )
SELECT
NON EMPTY { [Measures].[Sum of Sales_Value_USD], [Measures].[Sum of Sales_Value_USD Late] } ON COLUMNS,
NON EMPTY { ([DateDimension].[DATE_QUARTER].[DATE_QUARTER].ALLMEMBERS ) } ON ROWS
FROM [Model]
where
( [DateDimension].[NextQuarter].&[Yes] , { [ProductLine].[ProductHierarchy].[Product_Level5].&[PP100 - Electric Solutions], [ProductLine].[ProductHierarchy]
.[Product_Level5].&[PP200 - Gas Solutions], [ProductLine].[ProductHierarchy]
.[Product_Level5].&[PP300 - Water Solutions] },{ [SalesHistory].[Status].&[BACKLOG]
, [SalesHistory].[Status].&[HISTORY] } )
我需要将它们组合成1个结果集。请帮助我实现这个目标...... 我是MDX的新手,没有足够的信息。
由于
答案 0 :(得分:1)
由于[DateDimension]。[NextQuarter]。& [Yes]和[DateDimension]。[CurrentQuarter]。& [Yes]不是相同的层次结构,您不能简单地合并结果。
但您可以创建新的计算成员,以便在一个MDX中提取所有度量。
WITH MEMBER [Measures].[Sum of Sales_Value_USD CurrentQuarter] AS
([DateDimension].[CurrentQuarter].&[Yes], [Measures].[Sum of Sales_Value_USD])
MEMBER [Measures].[Sum of Sales_Value_USD Late CurrentQuarter] AS
([DateDimension].[CurrentQuarter].&[Yes], [Measures].[Sum of Sales_Value_USD Late])
MEMBER [Measures].[Sum of Sales_Value_USD NextQuarter] AS
([DateDimension].[NextQuarter].&[Yes], [Measures].[Sum of Sales_Value_USD])
MEMBER [Measures].[Sum of Sales_Value_USD Late NextQuarter] AS
([DateDimension].[NextQuarter].&[Yes], [Measures].[Sum of Sales_Value_USD Late])
SELECT
NON EMPTY{
[Measures].[Sum of Sales_Value_USD CurrentQuarter],
[Measures].[Sum of Sales_Value_USD Late CurrentQuarter],
[Measures].[Sum of Sales_Value_USD NextQuarter],
[Measures].[Sum of Sales_Value_USD Late NextQuarter]
} ON COLUMNS,
NON EMPTY { ([DateDimension].[DATE_QUARTER].[DATE_QUARTER].ALLMEMBERS ) } ON ROWS
FROM [Model]
where
({[ProductLine].[ProductHierarchy].[Product_Level5].&[PP100 - Electric Solutions],
[ProductLine].[ProductHierarchy].[Product_Level5].&[PP200 - Gas Solutions],
[ProductLine].[ProductHierarchy].[Product_Level5].&[PP300 - Water Solutions] } ,
{[SalesHistory].[Status].&[BACKLOG], [SalesHistory].[Status].&[HISTORY] } )