我对Nonempty()函数的理解是它需要第一个表达式,将它应用到第二个表达式上,并删除那些在第二个表达式中没有值的表达式。mdx非空排除存在的值
我
WITH
SET [Date Range] AS
Filter(
[Date].[Date].[Date],
[Date].[Date].CurrentMember.Member_Value >= CDate(@StartDateParam) AND
[Date].[Date].CurrentMember.Member_Value <= CDate(@EndDateParam)
)
MEMBER [Measures].[DateValue] AS
[Date].[Date].CurrentMember.Member_Value
SELECT
{
[Measures].[DateValue],
[Measures].[Work Item Count]
} ON COLUMNS,
{
CrossJoin(
[Date Range],
--NonEmpty(
[Work Item].[System_State].[System_State]
-- ,[Measures].[Work Item Count]
--)
)
} ON ROWS
FROM [Team System]
它返回
Date | State | DateValue | WorkItemCount
2/1/2015 | Active | 2/1/2015.. | 2
2/1/2015 | Resolved | 2/1/2015.. | (null)
2/2/2015 | Active | 2/2/2015.. | 1
2/2/2015 | Resolved | 2/2/2015.. | 1
2/3/2015 | Active | 2/3/2015.. | 0
2/3/2015 | Resolved | 2/3/2015.. | 2
当我去掉上面的非空代码, 我得到:
Date | State | DateValue | WorkItemCount
2/1/2015 | Resolved | 2/1/2015.. | (null)
2/2/2015 | Resolved | 2/2/2015.. | 1
2/3/2015 | Resolved | 2/3/2015.. | 2
我期待得到:
Date | State | DateValue | WorkItemCount
2/1/2015 | Active | 2/1/2015.. | 2
2/2/2015 | Active | 2/2/2015.. | 1
2/2/2015 | Resolved | 2/2/2015.. | 1
2/3/2015 | Resolved | 2/3/2015.. | 2
这里发生了什么?
出现这种情况的SQL Server 2014所以在SSAS MDX NonEmpty issue回答不适用
...这是性能增益确定吗? 'hasState'内的'iif'会有一些开销。将'AdvWks'中的一个好样本嘲笑起来会很有趣。也许用',null,1))替换',0,1))''可能会进一步提高速度。 – whytheq 2015-02-06 14:17:00
什么时候这部分条件是真的? 'ISEMPTY([Work Item]。[System_State] .currentmember.membervalue)' – whytheq 2015-02-06 14:21:10
当您有空成员值时,如果它在尺寸设置中被允许。我评论说,你可以把它拿出来,相当少见的情况 – George 2015-02-06 14:24:18