Reporting Services 2005在表中减去2个值

时间:2022-05-21 16:47:48

I have a list of fees being displayed in a table object. I would like to display the difference between 2 of the fees in a text box (not sure if this goes in the table footer or in a group footer). I am able to sum values easy but I don't see how I can subtract values. In this example let's say I would like to show the difference of the License fee and Registration fee (999-333). How can I do this using groups / filters etc? BTW I want to do this at the report level not in a stored procedure! Thanks in advance...

我有一个表对象中显示的费用列表。我想在文本框中显示2个费用之间的差异(不确定这是在表格页脚还是组页脚中)。我能够轻松地对值进行求和,但我不知道如何减去值。在这个例子中,假设我想显示许可费和注册费(999-333)的差异。如何使用组/过滤器等执行此操作?顺便说一句,我想在报告级别而不是在存储过程中这样做!提前致谢...

This is what the data out put looks like:

这就是输出数据的样子:

FeeDescription    FeeValue
License           $999.00 
Registration      $333.00 
Inspection        $444.00 
Title             $555.00 
Tire Fee          $5.00 
Battery Fee       $1.50 
MVWEA (Lemon Law) $2.00 

2 个解决方案

#1


I'm guessing you're using a table. So you can do the calculation with an expression in the relevant cell's Value property. For an item-level row: =Fields!License.Value - Fields!Registration.Value. For a group-level row: =sum(Fields!License.Value - Fields!Registration.Value).

我猜你在用桌子。因此,您可以使用相关单元格的Value属性中的表达式进行计算。对于项目级别行:= Fields!License.Value - Fields!Registration.Value。对于组级行:= sum(Fields!License.Value - Fields!Registration.Value)。

#2


something like this should work

这样的事情应该有效

=sum(iif(Fields!FeeDescription="License" or Fields!FeeDescription="Registration",Fields!FeeValue,0))

#1


I'm guessing you're using a table. So you can do the calculation with an expression in the relevant cell's Value property. For an item-level row: =Fields!License.Value - Fields!Registration.Value. For a group-level row: =sum(Fields!License.Value - Fields!Registration.Value).

我猜你在用桌子。因此,您可以使用相关单元格的Value属性中的表达式进行计算。对于项目级别行:= Fields!License.Value - Fields!Registration.Value。对于组级行:= sum(Fields!License.Value - Fields!Registration.Value)。

#2


something like this should work

这样的事情应该有效

=sum(iif(Fields!FeeDescription="License" or Fields!FeeDescription="Registration",Fields!FeeValue,0))