Set analysis won't work because the set is calculated per chart, not per row. Since you use month as a dimension you want the value of the month to determine the set. And as said that's not possible with set analysis. The if statement does work because that is evaluated per row. If the if statement turns out to give performance problems maybe you could create the cumulative sum in the script.
The if indeed gave me some performance problems in the past, the cummulative sum in the script works as well, only downside is that your data files grow and grow using that strategy.
Anyways thanks for your answer, I know what to do now and won't stare blind on the set analysis for this situation.