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

# Group Wise Incremental Calculation

## Group Wise Incremental Calculation

(OP)
Source

No  Al_No  Amt
X1   1      20
X1   2      30
X1   3      40
X1   4      50
X2   1      60
X2   2      20

I have a source as above

Data that shud be populated in Target

No  Al_No  Amt   Prev_buffer_Amt
X1   1      20      0 (shud be)
X1   2      30      20
X1   3      40      50 (sum of prev amts (20+ 30))
X1   4      50      90 (group wise calculations (20+30+40))
X2   1      60      0
X2   2      20      60

Data in Column Prev_buffer_amt shud be the Prev records sum amt (group by NO). For 1st records Prev_amt will be Zero.For 2nd record Prev_amt shud be the 1st record amt,
For 3rd record, sum of (1st and 2nd records amts)......

Can it be calculated in Expression Transformation?

kindly help....

### RE: Group Wise Incremental Calculation

(OP)
I got answer from the post given by MacLeod72 on running totals..
Port 1: KEY Input
Port 2: VAL Input
Port 3: V_TOTAL Variable Exp: IIF(KEY != V_KEY, VAL, V_TOTAL + VAL)
Port 4: V_KEY Variable Exp: KEY
Port 5: RUNNING_TOTAL Output Exp: V_TOTAL

Thanks to MacLeod72

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

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!