Flux Query/ Function to find the cumulative sum of the data

If I understood your problem right I solved it here: