INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Decimal in Wrong Place

Decimal in Wrong Place

(OP)
I am trying to summarize multiple bill amounts and I am getting the right numbers but the decimal is in the wrong spot. When I use this statement to get bill amounts for a case, it returns the correct amounts:
BILL_TOTAL= sum(CASE [TRAN_TYPE] WHEN 'BL' THEN([FEES_AMT]+[HARD_AMT]+[SOFT_AMT])*[SIGN] WHEN 'BLX' THEN([FEES_AMT]+[HARD_AMT]+[SOFT_AMT])*[SIGN] ELSE 0 end)
Results: 3475.18000000 and 29740.70000000
However, when I sum those 2 amounts by client, I get 332158.80000000 instead of 33215.88000000. All the fields being added in my statement are EXPCURRENCY(decimal(25,10)),null)
How do I fix this??

RE: Decimal in Wrong Place

Hard to tell with that field in isolation, but most likely, there's something in your code that's causing you to add these values in multiple times.

Tamar

RE: Decimal in Wrong Place

Quote:


I am trying to summarize multiple bill amounts and I am getting the right numbers but...

Could it be that you are summarizing 10 rows, resulting in your result being 10 times as great as what you expect?

First return the DISTINCT values and then SUM().

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close