Last active
June 19, 2017 18:57
-
-
Save malisper/4d56f24726733b390d07d45b3d9c6883 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
SELECT | |
SUM(funnel_events( | |
ARRAY_AGG(funnel_step ORDER BY time ASC, funnel_step DESC), | |
2)) AS funnel_results | |
FROM ((SELECT * | |
FROM (SELECT user_id, | |
time, | |
0 AS funnel_step | |
FROM "events" | |
WHERE type = 'click' | |
AND text = 'Login' | |
AND time BETWEEN 1476428400000 AND 1477033200000) events_1) | |
UNION ALL | |
(SELECT * | |
FROM (SELECT user_id, | |
time, | |
1 AS funnel_step | |
FROM "events" | |
WHERE type = 'click' | |
AND text = 'Purchase' | |
AND time BETWEEN 1476428400000 AND 1477033200000) events_2) | |
) events_query | |
GROUP BY user_id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
shoudn't the line 11 (
AND text = 'Login'
) beAND text = 'SignUp'
, as the example is demonstratingHow come Login is same as singed up ?