2011-08-18 66 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))