简体   繁体   English

SSRS 2008中的SUM的总和

[英]SUM of a SUM in SSRS 2008

I've this report 我有这份报告 在此处输入图片说明

  1. Here I make the first sum because I've grouped values from each month (months are "Gennaio", "Febbraio", "Marzo" etc etc.). 在这里,我进行了第一笔总和,因为我对每个月的值进行了分组(月份是“ Gennaio”,“ Febbraio”,“ Marzo”等)。 These values are hidden, but anyway I get the sum and I display the sum for each month. 这些值是隐藏的,但是无论如何我都会得到总和,并显示每个月的总和。

  2. Then I should make the second sum that use values for each month and display the total for each category. 然后,我应该使用每个月的值进行第二次总计,并显示每个类别的总计。 Categories are "TOTALE LAVORI RESTAURO", "TOTALE LAVORI EDILE" etc.) 类别为“ TOTALE LAVORI RESTAURO”,“ TOTALE LAVORI EDILE”等)

  3. This is the final sum, where I sum values from each category. 这是最终的总和,在这里我对每个类别的值求和。

Everything is working well, but now I have to add a "month" parameter to the report that returns sums until a selected month. 一切工作正常,但是现在我必须在报表中添加一个“ month”参数,该参数将返回总计,直到选定的月份为止。 This parameter changes the sum 1 with this expression: 此参数使用以下表达式更改总和1:

=Sum(IIf(Fields!mese.Value <= Parameters!mese.Value, Fields!costi.Value, 0))

Now, how should I change expression in SUM2 and SUM3 to work with this parameter? 现在,如何更改SUM2和SUM3中的表达式以使用此参数?

If I copy that code, ther returns #Error and as far as I know I can't use ReportItems sum. 如果我复制该代码,则返回#Error ,据我所知我不能使用ReportItems sum。

So any suggestion? 有什么建议吗?

SUM #1 could remain Sum(Fields!costi.Value ) because you need to display every months. SUM#1可以保持Sum(Fields!costi.Value ),因为您需要每月显示一次。 ie: display GIUGNO even if Parameters!mese.Value = 4 (APRILE). 即:即使Parameters!mese.Value = 4Parameters!mese.Value = 4 ),也显示GIUGNO。

So you have only to change SUM #2 and #3 because TOTALE LAVORI RESTAURO and TOTALI must show only costi from GENNAIO to Parameters!mese.Value ; 因此,您只需要更改SUM#2和#3,因为TOTALE LAVORI RESTAURO和TOTALI必须仅显示从GENNAIO到Parameters!mese.Value ie if Parameters!mese.Value = 4 display only GENNAIO-APRILE even if we have details about GIUGNO. 即,即使我们具有有关GIUGNO的详细信息,如果Parameters!mese.Value = 4仅显示GENNAIO-APRILE。

The expression gave error because you have NULL value in Fields!costi.Value or Fields!mese.Value : convert this value to zero in your DataSet and you won't have problems. 该表达式给出了错误,因为您在Fields!costi.ValueFields!mese.Value具有NULL值:在您的DataSet中将此值转换为零,并且不会有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM