MDX 使用 except 不起作用
我遇到以下问题:
Select
{
[Measures].[PerformanceTotalYtd]
} on columns,
Non Empty{
Except(([Desk].[DeskName].[Trade].Members,[Time].[Year-Month-Day].[Day].&[2012]&[1]&[10]),([Desk].[DeskName].[Trade].Members,[Time].[Year-Month-Day].[Day].&[2012]&[1]&[09]))
} on rows
from [Cube]
where ([Entity].[Entity].&[9], [Audience].[View].&[GOD])
存在一个名为 Name Desk 的维度。此维度有一个名为 DeskName 的层次结构。最低级别是贸易。
Desk: -Total -Segment -BusinessArea -Department -4th Level Portfolio -Desk -Trade
通过下面显示的查询,我想显示在 2012/01/10 日期具有度量“PerformanceTotalYtd”!= NULL 的所有交易交易日期为“PerformanceTotalYtd”!= NULL 的交易除外2012/01/09 !
示例:
在 2012/01/10 上使用 Measure PerformanceTotalYtd 进行交易:
ABC 12,99
DEF 3,22
GHI 55,60
在 2012/01/09 上使用 Measure PerformanceTotalYtd 进行交易:
ABC 80,00
DEF 8,78
我想要以下内容结果是因为交易“GHI”不存在2012/01/09 是新的:
GHI 55,60
下面显示的我的查询有以下结果:
ABC 12,99
DEF 3,22
GHI 55,60
它不会删除 2012/01/09 中的现有交易。
我有一个 SQL 解决方案,但想在 MDX 中实现:
SELECT DD.Code, Sum(PerformanceTotalYtd) as TOTAL
FROM [Reporting_DB].[Star].[Fact_PerformanceTotal] FIS
inner join Star.Dimension_Desk DD on FIS.DeskID = DD.DeskID
WHERE FIS.TimeID = 20120110 and FIS.EntityID = 9 AND DD.Code not in ( SELECT DD.Code
FROM [Reporting_DB_HRE].[Star].[Fact_PerformanceTotal] FIS inner join Star.Dimension_Desk DD on FIS.DeskID = DD.DeskID WHERE FIS.TimeID = 20120109 and FIS.EntityID = 9 group by DD.Code)group by DD.Code
有人可以帮助我吗?我找不到解决办法。
抱歉我的英语不好!
亚历克斯
I have the following Problem:
Select
{
[Measures].[PerformanceTotalYtd]
} on columns,
Non Empty{
Except(([Desk].[DeskName].[Trade].Members,[Time].[Year-Month-Day].[Day].&[2012]&[1]&[10]),([Desk].[DeskName].[Trade].Members,[Time].[Year-Month-Day].[Day].&[2012]&[1]&[09]))
} on rows
from [Cube]
where ([Entity].[Entity].&[9], [Audience].[View].&[GOD])
It exists a Dimension with the Name Desk. This Dimension has a Hierarchy with the name DeskName. The lowest Level ist Trade.
Desk: -Total -Segment -BusinessArea -Department -4th Level Portfolio -Desk -Trade
With the Query showing below, i want to show all Trades, that have the Measure "PerformanceTotalYtd" != NULL on the Date of 2012/01/10 except the Trades with the Measure "PerformanceTotalYtd" != NULL on the Date of 2012/01/09 !
Example:
Trades with Measure PerformanceTotalYtd on the 2012/01/10:
ABC 12,99
DEF 3,22
GHI 55,60
Trades with Measure PerformanceTotalYtd on the 2012/01/09:
ABC 80,00
DEF 8,78
I want the following Result because the Trade "GHI" doesn't exists on the 2012/01/09 and is new:
GHI 55,60
My Query showing below have this result:
ABC 12,99
DEF 3,22
GHI 55,60
It doesn't delete the existing Trades from the 2012/01/09.
I have a Solution in SQL but want to make it in MDX:
SELECT DD.Code, Sum(PerformanceTotalYtd) as TOTAL
FROM [Reporting_DB].[Star].[Fact_PerformanceTotal] FIS
inner join Star.Dimension_Desk DD on FIS.DeskID = DD.DeskID
WHERE FIS.TimeID = 20120110 and FIS.EntityID = 9 AND DD.Code not in ( SELECT DD.Code
FROM [Reporting_DB_HRE].[Star].[Fact_PerformanceTotal] FIS inner join Star.Dimension_Desk DD on FIS.DeskID = DD.DeskID WHERE FIS.TimeID = 20120109 and FIS.EntityID = 9 group by DD.Code)group by DD.Code
Can anybody help me please? I can't find a solution.
Sorry for my bad english!
Alex
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在 Adventure Works 立方体中找到了类似的示例:
集合
{[客户].[城市].&[贝尔花园]&[CA], [客户].[城市].&[贝尔维尤]&[WA], [客户].[ City].&[Bellflower]&[CA]}
的[Measures].[Internet Sales Amount]
有 3 个值[日期].[日历年].&[2002]
,并且[日期].[日历年].&[2004]
中只有 2 个值。因此,我们需要显示 2002 年成员的测量值,其中 2004 年的测量值 == null。下一个 MDX 查询达到了预期的结果:
我尝试相应地修改您的示例,但无法测试它。简而言之:
使用 Filter 而不是 except。
I have found a similar example in the Adventure Works cube:
The set
{[Customer].[City].&[Bell Gardens]&[CA], [Customer].[City].&[Bellevue]&[WA], [Customer].[City].&[Bellflower]&[CA]}
has 3 values for[Measures].[Internet Sales Amount]
in[Date].[Calendar Year].&[2002]
, and only 2 values in[Date].[Calendar Year].&[2004]
. So we need to show measure value for member in 2002 where measure value == null in 2004.The next MDX query achieves the desired result:
I tried to modify your example accordingly, but can't test it. Here it is:
In short: use Filter instead of Except.
我有解决我的问题的方法。以下查询显示与 Dmitry Polyanitsa 的查询相同的结果!祝大家有美好的一天!
I have the Solution for my Problem. Following Query shows the same Result as the Query of Dmitry Polyanitsa! Have a nice Day guys!