MDX内部/外部集合和别名

时间:2014-12-18 15:50:27

标签: mdx mondrian

我想创建一组2个成员:in&出。第一个包含维度的所有用户选择成员的聚合,第二个包含所有其他成员的聚合。我尝试了以下内容:

WITH set [ColSet] as
{
   [Lieu].[Societe].members * [Measures].[Mt]
}
set [InitSet] as
{
   [Date].[Annee].[2012],
   [Date].[Annee].[2013]
}
member [RowDim].[in] as aggregate
(
   [InitSet]
)
member [RowDim].[out] as aggregate
(
   except
   (
      [Date].[Annee].members,
      [InitSet]
   )
)
SELECT
NON EMPTY [ColSet] ON COLUMNS,
NON EMPTY
{
   [RowDim].[in],
   [RowDim].[out]
}
ON ROWS
FROM [Achat]

这给我以下结果:

| C - HYPERS DISTRIBUTION BANANA FRANCE | C - SUPERS DISTRIBUTION BANANA FRANCE | Y - BANANAS  |
| Mt bananas                            | Mt bananas                            | Mt bananas   |
+---------------------------------------+---------------------------------------+--------------+
|                        764,894,678.51 |                        476,684,988.46 | 2,371,343.76 |
|                         65,479,177.02 |                         41,021,522.71 | 9,374,639.28 |

问题是我无法显示标签" IN"和" OUT"在我的行轴上。有没有办法做到这一点?

我正在使用蒙德里安(3.6.7)。

1 个答案:

答案 0 :(得分:0)

那些似乎是“隐藏”的,可能是因为NON EMPTY条款。如果你想要出现标签,要么你需要摆脱它,或用零替换NULL(让它'空'不再)。请尝试以下代码:

WITH set [ColSet] as
{
   [Lieu].[Societe].members * [Measures].[Mt]
}
set [InitSet] as
{
   [Date].[Annee].[2012],
   [Date].[Annee].[2013]
}
member  [RowDim].[in] as IIF(ISEMPTY(aggregate
(
   [InitSet]
)) , 0, aggregate
(
   [InitSet]
))
member   [RowDim].[out] as IIF(ISEMPTY(aggregate
(
   except
   (
      [Date].[Annee].members,
      [InitSet]
   ))), 0, aggregate
(
   except
   (
      [Date].[Annee].members,
      [InitSet]
   ))
)
SELECT
NON EMPTY [ColSet] ON COLUMNS,

    {    
    [RowDim].[in],
    [RowDim].[out]
    }
ON ROWS
FROM [Achat]