使用 AVG & IIF return 为特定费用代码支付的平均费用

Using AVG & IIF to return the average paid for a specfic fee code

我正在尝试一份对我来说相当困难的报告 - 所以对新手要有耐心。我希望获得针对每种颁发的许可证类型收取的每种费用类型(指定列为 CODE)的平均金额。我写的表达式——以多种形式——如下。

 =AVG(IIF(Fields!CODE.Value="CODE-PERMIT",Fields!PAID_AMOUNT.Value),"FEES")

FEES 是数据集。我还使用了 Tablix 和 Group 作为范围。

我知道我遗漏了一些重要的东西,因为我收到了这个错误:

The Value expression for the textrun ‘Textbox582.Paragraphs[0].TextRuns[0]’ has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a dataset.

如有任何帮助,我们将不胜感激。

尝试:

=AVG(IIF(Fields!CODE.Value="CODE-PERMIT",Fields!PAID_AMOUNT.Value,Nothing),"FEES")

注意IIF()函数接受三个参数。

如果这对你有帮助,请告诉我。