Last active
November 17, 2015 15:37
-
-
Save jdwyah/952d4753418f6c823c74 to your computer and use it in GitHub Desktop.
This file contains 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
calculated as (select time_period, | |
case when lag is null then 'NEW' | |
when lag_size = 1 then 'ACTIVE' | |
when lag_size > 1 then 'RETURN' | |
end as this_month_value, | |
case when (lead_size > 1 OR lead_size IS NULL) then 'CHURN' | |
else NULL | |
end as next_month_churn, | |
count(distinct who_identifier) | |
from lag_lead_with_diffs | |
group by 1,2,3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment