Jump to content

Cumulative Sum with Breaks By Another Column


Steve Phillips 3

Recommended Posts

Trying to determine TERR Script for calculating a cumulative sum by well over time. For simplicity, data set is as follows:

WellNum,ProdMonth,OilVol

1,1,10000

1,2,9000

1,3,8000

2,1,4000

2,2,3000

3,1,6000

3,2,5000

3,3,4000

3,4,3000

Want to return a cumulative sum that starts over each time the WellNum changes:

WellNum,ProdMonth,OilVol,RunningTotalOil

1,1,10000,10000

1,2,9000,19000

1,3,8000,27000

2,1,4000,4000

2,2,3000,7000

3,1,6000,6000

3,2,5000,11000

3,3,4000,15000

3,4,3000,18000

I know how to accomplish this in Spotfire, but how do I do it in TERR cumsum works for the entire column but I haven't figured out the syntax to break on WellNum.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...