Calculating Churn Rates

Churn Project

Hi everyone!
I have attempted the bonus question - #9 on this exercise but am not sure if I am right.
Can anyone help to see if I did the appropriate thing?

How would you modify this code to support a large number of segments?

I edited the code to get this result below, where I added a new column for segments and grouped it.