# SUM positive and negative amounts

I am in the process of creating an invoice that  gives a balance due - however all credits and charges must be summed together to give a balance due.
The issue I am running into is that for some reason the result  i am getting does not equal what  I am expecting.

``````sum ({bilingitem.amountdue}) where billing.item is a combination of records with values such as \$200, \$47.30, -\$238
``````
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
DO you have all the values in the one field?  Are there both positive and negative values?

mlmcc
0
Commented:
What type is the field that you're trying to sum ?

SPykair
0
Author Commented:
MLMCC: I have the following scenraio on my invoice:

Code 7  -   Units 20 - Amount_Due - \$140
Code 10 - Units 5 - Amount_Due - \$100
Code 998 - Units 4 - Amount_Due (\$80) * this is a credit amount
Total Due on Invoice - \$160 (this would be a sum of Code 7 + Code 10 + Code 998)
In my Crystal report _ have a statement that says SUM({Amount_Due})

SPykair - I am trying to SUM (Money type fields) should I convert these to integers?

0
Author Commented:
Hi - can anyone help me with the issue described above?
0
Commented:
Is the Sum({MoneyField},{AccountId}) not working?

You can do it with formulas and variables.

mlmcc
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Thanks - that helped - had to pull up other Crystal Reports doing something similiar and seems I am ok now - you guys are great out here. Please keep up the good work
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.