2011-08-18 68 views
2

我正在嘗試計算報告中每個組項目的平均加權值。我用所有的建議在this link,但他們給我下面的錯誤:計算Reporting Services 2008中的加權平均值

Warning 1 [rsAggregateOfMixedDataTypes] The Value expression for the textrun ‘textbox134.Paragraphs[0].TextRuns[0]’ uses an aggregate function on data of varying data types. Aggregate functions other than First, Last, Previous, Count, and CountDistinct can only aggregate data of a single data type.

爲計算加權平均的最好辦法任何建議。我的最新嘗試是這樣的:

=iif(sum(iif(Fields!weight.Value is nothing,0,Fields!weight.Value))= 0, 0, sum(iif((Fields!myData.Value * Fields!weight.Value) is nothing,0,(Fields!myData.Value * Fields!weight.Value)))/ sum(Fields!weight.Value)) 

感謝

回答

0

按照exeption描述,我懷疑你的領域沒有設置任何數據集,因此,你可以計算聚合函數,如果你使用一個單一的文本框 - 嘗試使用表格(使用單列並刪除行,以便您將有一個Header單元格),並確保在表格屬性中將正確的數據集鏈接到該表格。

關於你的表情,試試這個insted的:

=iif(sum(iif(IsNothing(Fields!weight.Value),0,Fields!weight.Value))= 0, 0, sum(iif(IsNothing(Fields!myData.Value * Fields!weight.Value),0,(Fields!myData.Value * Fields!weight.Value)))/ sum(Fields!weight.Value))