使用IIF和SUM的MDX [英] MDX using IIF and SUM

查看:118
本文介绍了使用IIF和SUM的MDX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的MDX代码中,我只想获取上次指定时间(例如在示例01/06/2015中)的成员的度量聚合,否则我不希望它们.
我尝试了现有和存在,但没有运气.
我相信我必须使用IIF函数 像:

At the following MDX code I want to get the aggregate of measure only for members that are in the specified last time (like in example 01/06/2015), else I don't want them .
I tried existing and exists but without any luck.
I believe i have to use the IIF function like:

IIF DAYTIME, MEASURE D NOT NULL THEN AGGREGATE....

(如果在特定月份,小节D大于0,则在特定时间范围内对SUM小节D求和)

(if for the specific month, measure D is bigger than 0 then SUM measure D for the specific time range)

ELSE NULL.

(否则不会在输出中打印出来)

(Else not print it on output)

然后过滤E.members,其中SUM在行上测量D >1.

And then filter E.members where SUM measure D >1 ON ROWS.

WITH 
  MEMBER A AS 
    b + C 
  MEMBER [Measures].[Aggregate] AS 
    Aggregate
    (
        DAYTIME.[Month].&[2013-01-01T00:00:00]
      : 
        [DAYTIME].[Month].&[2015-06-01T00:00:00]
     ,[Measures].[D]
    ) 
SELECT 
  [Measures].[Aggregate] ON 0
 ,Filter
  (
    Exists
    (
      [E].MEMBERS
     ,[DAYTIME].[Month].&[2015-06-01T00:00:00]
    )
   ,
    [Measures].[Aggregate] > 1
  ) ON 1
FROM [CUBE];

推荐答案

尝试使用Sum而不是Aggregate.同样,由于[DAYTIME].[Month].&[2015-06-01T00:00:00]是度量[Measures].[Aggregate]的一部分,因此您可以删除Exists函数:

Try using Sum rather than Aggregate. Also as [DAYTIME].[Month].&[2015-06-01T00:00:00] is part of the measure [Measures].[Aggregate] you could delete the Exists function:

WITH 
  MEMBER [Measures].[Aggregate] AS 
    Sum
    (
        DAYTIME.[Month].&[2013-01-01T00:00:00]
      : 
        [DAYTIME].[Month].&[2015-06-01T00:00:00]
     ,[Measures].[D]
    ) 
SELECT 
  [Measures].[Aggregate] ON 0
 ,Filter
  (
    [E].MEMBERS
   ,[Measures].[Aggregate] > 1
  ) ON 1
FROM [CUBE];

注意:[Measures].[D]与这些成员[E].MEMBERS

这篇关于使用IIF和SUM的MDX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆