SSRS 2008 R2 Subtracting current row from previous row where data is summed

4.5k views Asked by At

I am fairly new to SSRS 2008 R2. Trying to convert my reports from Crystal. Thought this would be a simple task but this ended up being a pain. I have a table that is grouped by Year then Week_Number so the table looks this when run: (I am trying to create the total row)

     Week1   Week2   Week3   Week4
2013   1       2       5       4
2014   0       3       2       6
Total -1       1      -3       2

There is a row group called Year and column group called Week_Number. I have one expression in the total column Sum(Fields!TotalProdWTD.Value).

I added a group footer to try create the total row. I am able to sum the column works fine, I can get the value of the last row by doing this ReportItems!txtTotalProd.Value. But when I try to use

=Previous(ReportItems!txtTotalProd.Value) 

I get the aggregate functions can be used only on report items contained in page headers and footers message. I believe I have to add a reference to the group to make the previous function work, just not sure how to do that.

2

There are 2 answers

0
Mike On BEST ANSWER

I found what I was looking for here. At the bottom of the article: http://msdn.microsoft.com/en-us/library/ms157328.aspx

1
Mahmoud Bayoush On

With your report table Insert new row outside group below

And use your command: Sum(Fields!TotalProdWTD.Value) to expression textbox