Aggregate Sum and decimal dropped in result

  • Hello, I am presently using an Aggregate task in my dataflow.

    There is a group by to allow me to sum up a Credit Amount by all the common fields.

    In a very simple fashion my input from a flat file looks like this.

    Cust# Inv# Credit

    Amount

    12345 6789 -2098

    12345 6789 -1400

    Credit Amount is defined as DT_DECIMAL with a length of 8 and a scale of 2. I have also tried defining it as Numeric with a scale of 2 and I still get the same result.

    The aggregate is defined as

    Cust# Group by

    Inv# Group by

    Credit Amount Sum

    The resulting ouput from the aggregate is:

    Cust# Inv# Credit

    Amount

    12345 6789 -3498.00

    Why is my result -3498.00 and not -34.98?

    Since this is my result I then try to re-align my decimal by diving b a 100 in a derived column as shown below:

    Derived Expression Data Type Scale

    Column Name

    New_Cred_Amt CRED_AMT / 100 DT_DECIMAL 2

    The result of the divide is:

    New_Cred_Amt = 34.00 - Why are the cents dropped?

    Can anyone please help me with this?

    I do not know visual basic, but I was thinking that there must be some way to re-align the result from the aggregate using this language.

    Thank you in advance for your time and consideration of my

    dilemma.

  • Is this being done in SSIS, or T-Sql?

    I'm confused because of the forum you posted to.

    try to divide by 100.00 sometimes that fixes the issue.

  • 🙂

    Thank you for your question.

    This is actually being attempted within SSIS in the derived column transformation.

    If I need to re-post this in the appropriate forum please let me know and I will do so. My apologies if the posting is in the wrong place.

    Thanks..

  • 😀

    Thank you again for your reply and suggestion of dividing by 100.00.

    This did the trick.

    A bid you a Grand Day!!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply