Skip to content
Advertisement

Modify SQL to include cumulative sum of all enrollments

I am able to get members cancelled in a quarter with the below query –

The output is

If we started out with 100 members and 1 member enrolled every quarter. How do I get the cumulative number of members enrolled during these periods. For example, I need this output

The following sql can be used to calculate enrollments for every quarter.

Advertisement

Answer

You would use window functions:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement