How to add up row totals in report viewer

Risho picture Risho · May 8, 2013 · Viewed 10.7k times · Source

I'm new to reporting and the jargon that goes with so I will try to draw it insted of write it.

|         |   A   |   B   |   C   |   D   |   E   |
-------------------------------------------------
| Apples  |   1   |   3   |   6   |   2   |  12   |
-------------------------------------------------
| Oranges |   3   |   2   |   4   |   1   |  10   |
-------------------------------------------------
| Bananas |   5   |   3   |       |   1   |   9   |
-------------------------------------------------
|         |       |       |       |       |  31   |

I need to sum up the last column E where I indicated 31. The cells with values 12,10,9 are obtained by =Sum(Fields!A.Value + Fields!B.Value + Fields!C.Value + Fields!D.Value).

I can't change the sql query and/or the dataset that is used. Does any one have a suggestion? Thanks!

EDIT: I've added a function to the code

Public Total_lookup_Sum As Integer = 0 

Public Function Lookup_Sum(ByVal value As Integer) As Integer

  Total_lookup_Sum = Total_lookup_Sum + value     

  Return Total_lookup_Sum 

End Function

and calling like this Code.Equals(ReportItems!txtFruitTotal.Value) but I get FALSE.

Answer

Risho picture Risho · May 10, 2013

With a help of a colleague the answer was reached:

Sum(Fields!A.Value) + Sum(Fields!B.Value)  + Sum(Fields!C.Value) + Sum(Fields!D.Value)