SSRS报告生成#Error,没有详细信息

时间:2018-12-17 20:28:16

标签: tsql reporting-services group-by sum iif

这是我tablix的子部分。

enter image description here

这些是不可见的列,我将它们拉出到文本框中,以便可以在其他地方引用。我必须参考的数据必须在主组行中,否则我会收到一条错误消息。

这是A列中的代码

=Sum(iif(Parameters!season.Value = Fields!season.Value, Fields!pkg_due_amt.Value, 0))

这是B列中的代码,它会产生错误。

=Sum(iif(Fields!inDateRange.Value = TRUE and Parameters!season.Value = Fields!season.Value, Fields!pkg_due_amt.Value, 0))

如果我在B列中进行调整,我将获得以下代码:

=Sum(iif(Fields!inDateRange.Value = TRUE and Parameters!season.Value = Fields!season.Value, 1, 0))

上面两行之间的唯一区别是,我试图对字段pkg_due_amt而不是1求和。true字段中的1不会产生pkg_due_amt会产生的错误。

这是第一个问题。如您所见,在701947的右侧是#Error。

repor

第二个问题是在生成/预览时看起来像这样。如果您看上面的图片,则第一行/常规标题行还会生成一个#Error。那是最高的最高分组。当我尝试将pkg_due_amt替换为1时,它再次起作用,但这没有帮助。我需要的是该领域的总结。

编译错误如下:

enter image description here

Warning 1   [rsAggregateOfMixedDataTypes] The Value expression for the textrun ‘Textbox794.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.  ... 0   0   

Warning 2   [rsAggregateOfMixedDataTypes] The Value expression for the textrun ‘Textbox814.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.  ... 0   0   

Warning 3   [rsAggregateOfMixedDataTypes] The Value expression for the textrun ‘Textbox789.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.  ... 0   0   

1 个答案:

答案 0 :(得分:1)

这意味着pkg_due_amt0的数据类型不同,可能就像一个int和一个decimal一样简单-您可以通过以下方式解决它使用强制转换功能,例如CDec(Fields!pkg_due_amt.Value), CDec(0)