Conditional Acummulate for a CUSUM control chart

I would like to develop a CUSUM control chart.
For this, I need to acucumulate the value of a variable until the initial variable becomes zero.
At that point, the sum resets to zero
Any ideas ?
Thank you for your help. Regards…!!!

ima1

Hello @JosepE,
Are you hoping to do this with Flux?
Unfortunately I dont think that’s possible.
I would recommend doing it with a client library and python.

something like:

def compute_cusum(initial_values):
    acum = 0
    cusum_values = []

    for value in initial_values:
        if value == 0:
            acum = 0
        else:
            acum += value
        cusum_values.append(acum)

    return cusum_values

What a shame!
But I am grateful for your help.
Thank you