各种集合的MDX总和

时间:2016-06-16 09:46:51

标签: sum set mdx

我的数据立方体具有大量学术课程的维度。我想按课程名称(使用过滤器和Inst)对课程进行分组(创建一组),以便我可以计算一些汇总统计数据。也就是说,我最终会想要列出那些与这些分组一起开课的人员名单(稍后由他们的家乡地理分开)。

我有四个措施,包括

names(which(df!=0, arr.ind=TRUE)[,1])
#[1] "Terminal Two"   "Terminal Three"

我设法制作了两套:

[Measures].[Achievements]
[Measures].[Starts]
[Measures].[Enrolments]
[Measures].[Leavers]

然后我可以查询一组:

CREATE SET [MyDataCube].[BA] AS
    {FILTER(
    [Aim].[Aim Title].[Aim Title].Members,
    (InStr(1, [Aim].[Aim Title].CurrentMember.NAME, "BA ") <> 0) 
        )
        }

GO

CREATE SET [MyDataCube].[BSc] AS
    {FILTER(
    [Aim].[Aim Title].[Aim Title].Members,
    (InStr(1, [Aim].[Aim Title].CurrentMember.NAME, "BSc") <> 0) 
        )
        }

但是我怎样才能找到[Geography - Learner Home]的表格。[学习者家]。[全部]在行上,列上所有[Bsc]和[BA]课程的总和,如:< / p>

desired set output

我想为[Measures]做这个。[Starts]。

1 个答案:

答案 0 :(得分:0)

以下可能是:

WITH 
MEMBER [Aim].[Aim Title].[All].[BA] AS
  AGGREGATE(
   [BA]
  )
MEMBER [Aim].[Aim Title].[All].[BSc] AS
  AGGREGATE(
   [BSc]
  )
SELECT   
NON EMPTY 
[Geography - Learner Home].[Learner Home].MEMBERS ON ROWS,
NON EMPTY 
{
  [Aim].[Aim Title].[All].[BA]
 ,[Aim].[Aim Title].[All].[BSc]
} ON COLUMNS
FROM [MyDataCube]
WHERE  [Measures].[Starts];