蒙德里安:计算过滤器总数

时间:2017-11-22 08:49:53

标签: mdx mondrian

我有这个MDX查询:

    with member [Measures].[count] as '[Measures].[NUMBER]'
         ** member [Measures].[total] as 'sum({[RECORD_TYPE.VALUES].[All VALUEs].children})' **
         member [Measures].[% records] as '([Measures].[count] / [Measures].[total])', format_string = "0.0%"
   select {[Measures].[count], [Measures].[% records], [Measures].[total]} ON COLUMNS,
  [RECORD_TYPE.VALUE].[1] ON ROWS
    from [RECORDS]
   where Crossjoin({[CITY].[LONDON]}, {([DATE.DATE].[20171101] : [DATE.DATE].[20171130])})

我发现这个[总]会员只按日期计算过滤记录(记录20171101和20171130之间的数据)。 如果我将此总数切换为:

member [Measures].[total] as 'sum({[DATE.DATE].[All DATEs].children})'

无论是哪个城市,我都会在立方体中获取所有记录。

我希望这个总数是[CITY]。[LONDON]在立方体中的记录总数,无论记录类型如何。你能告诉我我该怎么办?

1 个答案:

答案 0 :(得分:1)

我不是蒙德里亚专家,但我的猜测如下:

  with member [Measures].[count] as '[Measures].[NUMBER]'
         ** member [Measures].[total] as 'sum({[RECORD_TYPE.VALUES].[All VALUEs].children} * [CITY].[LONDON])' **
             member [Measures].[% records] as '([Measures].[count] / [Measures].[total])', format_string = "0.0%"
       select {[Measures].[count], [Measures].[% records], [Measures].[total]} ON COLUMNS,
      [RECORD_TYPE.VALUE].[1] ON ROWS
        from [RECORDS]
       where Crossjoin({[CITY].[LONDON]}, {([DATE.DATE].[20171101] : [DATE.DATE].[20171130])})