cumulative sum
Is there a simple way to calculate the cumulative sum when there is a group and subgroup that are to be cumulative sum. Shown in the following picture, I want to calculate cumulative sum for batch 1 and all sample a, then batch 1 and all sample b and then batch 1 and all sample c.