How do I sum only negative field values in MS SQL reports

Hi Xperts.

This might be an easy answer for you guys, but its a tough question for me!

I've built a simple SQL report which needs to total wirless accounts which have negative message balances on their unit's.

and then sum only the negative values in order to produce a total of the negative numbers ignoring the positive numbers.

EXAMPLE of what I need:

Record 1 Value  2
Record 2 Value -2
Record 3 Value -2

SUM of ALL records =  -4 which ignores the positive numbers

My current formula doesn't work because it 'sums' everything instead of just negative numbers.

=Sum(Fields!OverageRemain.Value)

Thank you very much for your help.

Bill
wtsumpesAsked:
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.

Anthony PerkinsCommented:
Without seeing your table structure it is a little difficult to know, but something like this should work:

Select Account, SUM(OverageRemain)
From  TableName
Where SIGN(OverageRemain)  != 1
Group By Account
0
amyhxuCommented:
=  Sum(iif(Fields!OverageRemain.Value >= 0, 0, Fields!OverageRemain.Value))
0

Experts Exchange Solution brought to you by

Your issues matter to us.

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

Start your 7-day free trial
amyhxuCommented:
Have you tried my solution? It should work for you.
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
DB Reporting Tools

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.