2014-02-24 98 views
1

非空函數我寫了一個計算的措施如下計算測量

With member [Measures].[Path] as 
Iif (condition, DisplayIteration, null) 


Select [Measures].[Path] , 
[Measures].[Caption], 
[Measures].[Value] on 0 , 
{NonEmpty 
(
Crossjoin (
[Item].[Product], 
Descendants ([Item].[Iteration]) 
) 
, Descendants ([Item].[Iteration]) 
) 
}on 1 from [Item] 

的[措施] [路徑]是報表參數標籤和[措施]。[值]是一個報表參數值。由於過濾器應用於後代([Item]。[Iteration]),因此仍然可以看到[Measures]。[Path]的空值。是否有任何方法可以解決這個問題?

+0

對於行而不是'NonEmpty'函數,您是否嘗試過'NON EMPTY'?爲什麼你「不能申請非空功能她」?在你的問題中我沒有看到任何理由。 – FrankPl

+0

@FrankPl感謝您的回覆。我對代碼進行了更改,請爲此方案建議一個解決方案。 – user2974732

+0

您的要求是不要顯示所有三個度量都爲NULL的行嗎?或者是不顯示行['Measures]。[Path]'爲空的行嗎?在後一種情況下,您是否想要查看「[Measures]。[Path]」爲零的行? – FrankPl

回答

0

我看到兩個可能性lities接近您的要求:

要麼使用[Measures].[Path]作爲第二個參數,以NonEmpty

With member [Measures].[Path] as 
Iif (condition, DisplayIteration, null) 

Select [Measures].[Path] , 
[Measures].[Caption], 
[Measures].[Value] on 0 , 
{NonEmpty 
(
Crossjoin (
[Item].[Product], 
Descendants ([Item].[Iteration]) 
) 
, { [Measures].[Path] } 
) 
}on 1 from [Item] 

,或者使用HAVING代替NonEmpty,其可以是更具選擇性的條件:

With member [Measures].[Path] as 
Iif (condition, DisplayIteration, null) 

Select [Measures].[Path] , 
[Measures].[Caption], 
[Measures].[Value] on 0 , 
Crossjoin (
[Item].[Product], 
Descendants ([Item].[Iteration]) 
) 
Having Not [Measures].[Path] Is null 
on 1 from [Item] 

我不確定結果或表現的正確性的影響,你將不得不測試。

+0

嘗試了兩種方式 1. \t當使用[Measures]。[Path]作爲第二個參數時,它將刪除所有空值,但顯示的迭代次數比它應有的多得多。只有在給後代([Work Item]。[Hierarchy])時,所需的迭代纔會被取消(但你知道它仍然有空值問題) 2. \t當使用「having」時,大量的迭代被拉下來, null問題依然存在。 – user2974732

+0

@ user2974732也許你應該嘗試一種組合的方法:保留帶有後代([Work Item]。[Hierarchy])的'NonEmpty''作爲第二個參數,並添加'Having Not [Measures]。[Path] Is在'on 1'之前的'null'。 – FrankPl

+0

嘗試了組合的方法。它與沒有[度量值]的相同,[路徑]爲空 – user2974732