首页 > 解决方案 > 按报表项目计算排序行组

问题描述

我的报告中有一个计算reportitems!Textbox42.Value - reportitems!Textbox39.value

如何通过此计算对行组进行排序,排序中不接受报表项。

我尝试根据上述表达式创建一个计算字段,但得到一个错误FieldValue are denying reportitems

标签: sql-serverreporting-servicesssrs-2012

解决方案


您不能ReportItems!Test.Value在计算字段中使用,这是不可能的以及聚合函数。

您必须在 tablix 的排序表达式中编写计算。例如:

'Expression of Textbox1 in Tablix1
=Fields!Sales.Value - Fields!Income.Value

'Expression of Textbox2 in Tablix1
=Fields!Sales.Value / Fields!Income.Value

'The next two expressions are the same
=ReportItems!Textbox1 * ReportItems!Textbox2  'Label1
=(Fields!Sales.Value - Fields!Income.Value) * (Fields!Sales.Value / Fields!Income.Value)  'Label2

转到Tablix Properties > Sorting > Add > Expression下的 tablix并写入来自Label2的表达式。这样你就可以根据你的表达进行排序。

如果您的 tablix 中有一些分组,您也可以在Row Groups > Group Properties (下拉) > Sorting > Add > Expression下转到 tablix 。


推荐阅读