MDX按行值记录

时间:2018-08-09 23:36:22

标签: mdx mdx-query

我目前在MDX中有以下代码,我一直在努力以所需的方式进行格式化。

WITH

MEMBER measures.Quantity_Chicago_Madison AS
    IIF([Tb Consumer].[City].currentmember is [Tb Consumer].[City].& 
    [Chicago] and [Tb Supplier].[City].currentmember is [Tb Supplier].[ 
    City].&[Madison], [Measures].[Quantity - Tb Transactions], null)

MEMBER measures.Quantity_Madison_Chicago AS
  IIF([Tb Consumer].[City].currentmember is [Tb Consumer].[City].&[Madison] 
  and [Tb Supplier].[City].currentmember is [Tb Supplier].[City].&[Chicago]  
   , [Measures].[Quantity - Tb Transactions], null)

SELECT non empty {
measures.Quantity_Madison_Chicago,measures.Quantity_Chicago_Madison
} ON COLUMNS, non empty

{  [Tb Product].[Name].[Name].ALLMEMBERs*[Tb Consumer].[City].allmembers* 
[Tb 
Supplier].[City].allmembers} ON ROWS

FROM [DS715]

我从运行此查询得到以下输出。 Current Output

理想情况下,我希望输出如下:Ideal Output

我觉得我已经尝试了一切,但是我知道我还没有完全弄清楚其中的一个难题。任何帮助都将如此巨大。谢谢

1 个答案:

答案 0 :(得分:0)

请尝试以下脚本:

WITH

MEMBER measures.Quantity_Chicago_Madison AS
    ([Tb Consumer].[City].&[Chicago] * [Tb Supplier].[City].&[Madison] , [Measures].[Quantity - Tb Transactions])

MEMBER measures.Quantity_Madison_Chicago AS
  ([Tb Consumer].[City].&[Madison] * [Tb Supplier].[City].&[Chicago] , [Measures].[Quantity - Tb Transactions])

SELECT non empty {
measures.Quantity_Madison_Chicago,measures.Quantity_Chicago_Madison
} ON COLUMNS, non empty

{  [Tb Product].[Name].[Name].ALLMEMBERs } ON ROWS

FROM [DS715]