如何合并两个具有不同度量和过滤器的 MDX 查询结果?

How to merge two MDX query results having different measures and filters?

首先说我是 MDX 的新手,我需要将两个(或更多)查询结果合并到一个数据透视表中。

查询将在 ROWS 和 COLUMNS 上具有相同的维度,但具有不同的度量和过滤器(通常是时间段)。

这是一个例子

查询 1:

SELECT
NON EMPTY {{[stores].[storecountry].[storecountry].Members}} ON COLUMNS, 
NON EMPTY {{[SalesTypes].[Description].[Description].Members}} * 
           {[Measures].[TransactionValue], [Measures].[TransQty]} ON ROWS 
FROM [Model] 
WHERE ({[dDates].[Date].[Date].&[2016-01-05T00:00:00] : [dDates].[Date].[Date].&[2016-01-12T00:00:00]})

查询 1 的结果:

                                    CA    US
Regular Sale    TransactionValue    761   16
Regular Sale    TransQty            8     233
Return          TransactionValue    156   4
Return          TransQty            1     45

查询 2:

SELECT
NON EMPTY {{[stores].[storecountry].[storecountry].Members}} ON COLUMNS, 
NON EMPTY {{[SalesTypes].[Description].[Description].Members}} * 
           {[Measures].[DiscountPerc]} ON ROWS 
FROM [Model] 
WHERE ({[dDates].[Date].[Date].&[2015-03-12T00:00:00] : [dDates].[Date].[Date].&[2015-06-02T00:00:00]})

查询 2 的结果:

                                CA       US
Regular Sale    DiscountPerc    40 %     59 %
Return          DiscountPerc    32 %     43 %

合并后的预期结果

                                    CA       US
Regular Sale    TransactionValue    761      16
Regular Sale    TransQty            8        233
Regular Sale    DiscountPerc        40 %     59 %
Return          TransactionValue    156      4
Return          TransQty            1        45
Return          DiscountPerc        32 %     43 %

是否可以在不从调用应用程序手动合并 AdomdClient.CellSet 的情况下实现?

谢谢!

我会使用计算成员:

with 
Member [Measures].[TransactionValueReport] as
Aggregate(
    {[dDates].[Date].[Date].&[2016-01-05T00:00:00]:[dDates].[Date].[Date].&[2016-01-12T00:00:00]},
    [Measures].[TransactionValue]
)

Member [Measures].[TransQtyReport] as
Aggregate(
    {[dDates].[Date].[Date].&[2016-01-05T00:00:00]:[dDates].[Date].[Date].&[2016-01-12T00:00:00]},
    [Measures].[TransQty]
)

Member [Measures].[DiscountPercReport] as
Aggregate(
    {[dDates].[Date].[Date].&[2015-03-12T00:00:00]:[dDates].[Date].[Date].&[2015-06-02T00:00:00]},
    [Measures].[DiscountPerc]
)

Select
Non Empty [stores].[storecountry].[storecountry].Members on 0,
Non Empty [SalesTypes].[Description].[Description].Members * {[Measures].[TransactionValueReport],[Measures].[TransQtyReport],[Measures].[DiscountPercReport]} on 1
From [Model]