This seems to work for me. Might not be the most efficient.
Names default to here(1);
dt = New Table( "ColCumSum with Reset",
Add Rows( 6 ),
New Column( "DateTime Started",
Numeric,
"Continuous",
Format( "m/d/y h:m", 19 ),
Input Format( "m/d/y h:m" ),
Set Values(
[3629174400, 3629181600, 3629199600, 3629210400, 3629217600, 3629224800]
)
),
New Column( "DateTime Ended",
Numeric,
"Continuous",
Format( "m/d/y h:m:s", 23, 0 ),
Input Format( "m/d/y h:m:s", 0 ),
Set Values(
[3629178000, 3629188800, 3629210400, 3629214000, 3629221200, 3629228400]
)
),
New Column( "Jobs",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [2, 5, 5, ., 2, 2] )
),
New Column( "Event",
Character( 16 ),
"Nominal",
Set Values( {"Work", "Work", "Work", "Replacement", "Work", "Work"} )
),
);
dt << New Column( "Jobs Part has Done",
Formula(
If(
Row() == 1, :Jobs,
:Event == "Replacement", 0,
Lag( :Jobs Part has Done ) + :Jobs
)
)
);