2017-04-23 88 views
0

我的報告有兩個數據集,主數據集和第二個數據集(僅包含一行)。我需要計算主數據集中某個列的多少個值低於從第二個數據集取得的值。我使用的表達式爲:SSRS 2008 - 一個表達式中的兩個數據集

=Count(IIf(Fields!TestValue.Value < First(Fields!NetUnitWeight.Value, "SecondDataSet"), 1, Nothing), "MainDataSet") 
    & " of " & CountRows("MainDataSet") 

,但我得到了以下錯誤:

[rsAggregateofAggregate] The Value expression for the textrun 'Textbox1.Paragraphs[0].TextRuns[0]' contains an aggregate function (or RunningValue or RowNumber functions) in the argument to another aggregate function (or RunningValue). Aggregate functions cannot be nested inside other aggregate functions.

我試圖通過把First(Fields!NetUnitWeight.Value, "SecondDataSet")在報表變量來解決這個問題,但這並沒有工作。我該如何解決它?

回答

0

好的,我找到了一個解決方法。我添加了一個新的報告參數,右鍵單擊它打開它的屬性,然後單擊「默認值」。我選擇了「從查詢中獲取值」並選擇我需要的數據集和值字段。現在這個表達式沒有錯誤:

=Count(IIf(Fields!TestValue.Value < Parameters!NetUnitWeight.Value, 1, Nothing), "MainDataSet") 
& " of " & CountRows("MainDataSet") 
+0

你可能想看看LOOKUP函數來完成你想要用FIRST做的事情。創意解決方案雖然,好主意! – Lucky

相關問題