Link to home
Start Free TrialLog in
Avatar of cindyfiller
cindyfillerFlag for United States of America

asked on

ssrs 2008 r2 error trying to do a grand total

I have a financial report that includes 3 fields that I'm trying to sum.  I only display a grouped total - not the detail.  One field sums a planned gift and both the grouped total and the final total works fine using sum(amount).  One of the fields is the asset balance and one is Net Present Value that is calculated on the report side.  All of the grouping totals work, but when I do the final totals I have a variety of problems.  I've listed some of the things I've tried and what the result is... sometimes it is an amount that is incorrect and sometimes it is an error.  The code I'm using (which I know very little about) is at the end of this.  

sum(asssetbalance)  - is the wrong amount - it is way too large (it should only sum the first asset balance)
sum(first(assetbalance)) - error that aggregate functions cannot be specified as nested aggregates
=Code.GetABTotal() - is the wrong amount - it appears that it totals each page, not a grand total
=sum(ReportItems!textbox72.Value) - gives me an error uses an aggregate function on a report item

I read that that you have to move the =sum(ReportItems!textbox72.Value)  to a footer so I tried that as well and it once again appears that it is totaling the page and not providing a grand total.  

Here is the code I tried and is for both fields that I'm trying to total:

Public Dim FVTotal as Double = 0
Public Dim ABTotal as Double = 0

Public Function AddFVTotal (Amt as Double) as Double
      FVTotal = FVTotal + Amt
      AddFVTotal = 0
End Function

Public Function GetFVTotal as Double
      GetFVTotal = FVTotal
End Function

Public Function AddABTotal (Amt as Double) as Double
      ABTotal = ABTotal + Amt
      AddABTotal = 0
End Function

Public Function GetABTotal as Double
      GetABTotal = ABTotal
End Function
ASKER CERTIFIED SOLUTION
Avatar of cindyfiller
cindyfiller
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cindyfiller

ASKER

That was the solution