在 Reporting Services 2008 中计算加权平均值

发布于 2024-11-30 05:31:51 字数 706 浏览 0 评论 0原文

我正在尝试计算报告中每个组项目的平均加权值。我使用了 此链接中的所有建议,但所有这些都给我以下错误:

警告 1 [rsAggregateOfMixedDataTypes] 的值表达式 textrun 'textbox134.Paragraphs[0].TextRuns[0]' 使用聚合 对不同数据类型的数据进行函数处理。聚合函数其他 比 First、Last、Previous、Count 和 CountDistinct 只能 单一数据类型的聚合数据。

有关计算加权平均值的最佳方法的任何建议。我最近的尝试是这样的:

=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))

谢谢

I am trying to calculate average weighted value for each group item in my report. I used all of the suggestions at this link, but all of them give me the following error:

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.

Any suggestion for the best way to calculate weighted average. My latest attempt is this:

=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))

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

听不够的曲调 2024-12-07 05:31:51

根据例外描述,我怀疑您的字段没有设置任何数据集,因此您可以计算聚合函数,如果您使用单个文本框 - 尝试使用表格(使用单列并删除行,这样您就可以计算聚合函数)将有一个标题单元格),并确保在表属性中将正确的数据集链接到它。

关于您的表达式,请尝试安装以下表达式:

=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))

According to the exeption description , I suspect that your field isn't set with any dataset and therefor you can calculate aggregate functions , if you using a single text box - try to use a table (use single column and delete the rows so aventually you will have a Header cell), and make sure in the table properties that you linked the right dataset to it.

About your expression, try this one 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))

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文