Created
April 6, 2016 19:11
-
-
Save jthandy/a2a05d41b5efadcd86773f23f187e620 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
news as ( | |
select date_month, sum(total) as value | |
from data | |
where revenue_category = 'new' | |
group by 1 | |
), renewals as ( | |
select date_month, sum(renewal_component_of_change) as value | |
from data | |
where revenue_category in ('renewal', 'downgrade', 'upgrade') | |
group by 1 | |
), prepaids as ( | |
select date_month, sum(total) as value | |
from data | |
where revenue_category = 'prepaid renewal' | |
group by 1 | |
), churns as ( | |
select date_month, sum(total) as value | |
from data | |
where revenue_category = 'churn' | |
group by 1 | |
), upgrades as ( | |
select date_month, sum(change) as value | |
from data | |
where revenue_category = 'upgrade' | |
group by 1 | |
), downgrades as ( | |
select date_month, sum(change) as value | |
from data | |
where revenue_category = 'downgrade' | |
group by 1 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment