我對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