Churn rate part 5 please help

Hi,

I am having a huge amount of trouble with part five of the codeflix churn rate exercise
https://www.codecademy.com/paths/analyze-data-with-sql/tracks/analyze-data-sql-analyze-real-data/modules/analyze-data-sql-user-churn/projects/calc-churn-proj
, specifically at part 5

I’ve redone it multiple times, copied directly from the video and looked for answers in the forum but I just can’t get it to work

Here’s my code, can someone please tell me where I’ve gone wrong

WITH months AS

(SELECT

‘2017-01-01’ as first_day,

‘2017-01-31’ as last_day

UNION

SELECT

‘2017-02-01’ as first_day,

‘2017-02-31’ as last_day

UNION

SELECT

‘2017-03-01’ as first_day,

‘2017-03-31’ as last_day

),

cross_join AS

(SELECT *

FROM subscriptions

CROSS JOIN months),

status AS

(SELECT id, first_day AS month,

CASE

WHEN (subscription_start < first_day)

AND

(subscription_end > first_day OR subscription_end IS NULL)

AND

(segment = 87)

THEN 1

ELSE 0

END AS is_active_87

)

SELECT *

FROM status

LIMIT 5

;

many thanks for any help.

Hi, welcome to the forums!

Do you mean Q5-“create a temporary table, status from the cross join table you created…”?

Re-read the question. I think there is a 2nd CASE statement that you’re missing in the query. Hint: is_active_30

Try that and see if it works.

That’s the one

I’ve tried with the segment 30 bit, but I’m still not getting anything

Also, in your dates…there aren’t 31 days in February.

Copy all your code, paste it elsewhere temporarily. then try resetting the workspace. and paste your code back into the console…
maybe that will work?
(I’m trying that now…)

I just followed the video just in case I’d made a mistake and when I queried each part, every single part I got results. However, when all the code is there, you don’t get every query’s result. The only results that print out are 3-- the 1st, 2nd and last Q’s.

It might be b/c it’s a deprecated lesson(?) That is what the title says in the video.

Are you able to move past and the lesson shows as completed?

I am experiencing a very similar issue and even though I have re-written the code 3 times (from the video too), it’s still not working I guess it is a bug, but since the concept is clear I suggest you move on and continue to marketing attribution :slight_smile: