INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• 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.

# Decimal in Wrong Place

 Forum Search FAQs Links MVPs

## 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,

Just traded in my OLD subtlety...
for a NUance!

#### 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.

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

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

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:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!