# Sum Function (ReportViewer)

• ### Question

• I am trying to use this function but for some reason i get the wrong output.

i have a  report that lists all the 'vendors' and their account 'balance' there are 4 cols of diif amounts

 John Doe 50 300 100 50
 John Doe 50 250 400 50

Sum Function (ReportViewer)

Returns a sum of the values of the specified expression.

in the report the insert a group by 'vendors'.. and on the fields i have sum(Fields!OBal_PostedBal.Value).. etc
i should get soemthing like this:

 John Doe \$100.00 \$550.00 \$500.00 \$100.00

BUT i get this

 John Doe \$200.00 \$1100.00 \$1000.00 \$200.00

for some reason it adds (sum) the amoutn and then multiplies it by the number of records in the table for that particular vendor... in this example its 2

Whats happening!!??!?

Monday, December 3, 2007 7:09 PM

### All replies

• is your  Sum Function in the group footer?

Monday, December 3, 2007 7:57 PM
•

the sum function is on the columns, sum(Fields!OBal_PostedBal.Value), i dont understand what you mean by group footer... ?!?

Tuesday, December 4, 2007 2:34 PM
• Well, I assume your using a table control to display this info...And then grouping on vendors?

When you insert a group to a table, it can have a group header and a group footer...basically extra rows in the table associated with the grouping.   If you put your sum function in the group footer, it will sum only the amounts in that group.

So it's important to be sure of where you put your Sum function in a table, because it does affect how it calculates.  If your not using groups at all, then put your Sum Function in the table footer.

Tuesday, December 4, 2007 2:38 PM