Report not found

There was a problem finding this report.
Scenarios - Average time since last activity
March 16, 2016 · Refreshed about 3 years ago
Description
Average time since a user was last seen for each scenario.

Collaborators

Run History
WITH events AS ( SELECT user_id, occurred_at, MIN(occurred_at) OVER (PARTITION BY user_id) AS first_event FROM modeanalytics.retention_scenarios WHERE event_type = 'engagement' AND scenario = 1 ), event_age AS ( SELECT DISTINCT user_id, FLOOR((EXTRACT('EPOCH' FROM occurred_at) - EXTRACT('EPOCH' FROM first_event))/(60*60*24)) AS periods_out FROM events ), adjacent_events AS ( SELECT e.user_id, e.periods_out, e.periods_out - LAG(e.periods_out,1) OVER (PARTITION BY user_id ORDER BY e.periods_out) AS periods_since_last FROM event_age e ) SELECT e.periods_out, AVG(e.periods_since_last) AS avg_time FROM adjacent_events e WHERE periods_out >= 1 AND periods_out <= 30 GROUP BY 1 ORDER BY 1
WITH events AS ( SELECT user_id, occurred_at, MIN(occurred_at) OVER (PARTITION BY user_id) AS first_event FROM modeanalytics.retention_scenarios WHERE event_type = 'engagement' AND scenario = 1 ), event_age AS ( SELECT DISTINCT user_id, FLOOR((EXTRACT('EPOCH' FROM occurred_at) - EXTRACT('EPOCH' FROM first_event))/(60*60*24)) AS periods_out FROM events ), adjacent_events AS ( SELECT e.user_id, e.periods_out, e.periods_out - LAG(e.periods_out,1) OVER (PARTITION BY user_id ORDER BY e.periods_out) AS periods_since_last FROM event_age e ) SELECT e.periods_out, AVG(e.periods_since_last) AS avg_time FROM adjacent_events e WHERE periods_out >= 1 AND periods_out <= 30 GROUP BY 1 ORDER BY 1
WITH events AS ( SELECT user_id, occurred_at, MIN(occurred_at) OVER (PARTITION BY user_id) AS first_event FROM modeanalytics.retention_scenarios WHERE event_type = 'engagement' AND scenario = 2 ), event_age AS ( SELECT DISTINCT user_id, FLOOR((EXTRACT('EPOCH' FROM occurred_at) - EXTRACT('EPOCH' FROM first_event))/(60*60*24)) AS periods_out FROM events ), adjacent_events AS ( SELECT e.user_id, e.periods_out, e.periods_out - LAG(e.periods_out,1) OVER (PARTITION BY user_id ORDER BY e.periods_out) AS periods_since_last FROM event_age e ) SELECT e.periods_out, AVG(e.periods_since_last) AS avg_time FROM adjacent_events e WHERE periods_out >= 1 AND periods_out <= 30 GROUP BY 1 ORDER BY 1
WITH events AS ( SELECT user_id, occurred_at, MIN(occurred_at) OVER (PARTITION BY user_id) AS first_event FROM modeanalytics.retention_scenarios WHERE event_type = 'engagement' AND scenario = 2 ), event_age AS ( SELECT DISTINCT user_id, FLOOR((EXTRACT('EPOCH' FROM occurred_at) - EXTRACT('EPOCH' FROM first_event))/(60*60*24)) AS periods_out FROM events ), adjacent_events AS ( SELECT e.user_id, e.periods_out, e.periods_out - LAG(e.periods_out,1) OVER (PARTITION BY user_id ORDER BY e.periods_out) AS periods_since_last FROM event_age e ) SELECT e.periods_out, AVG(e.periods_since_last) AS avg_time FROM adjacent_events e WHERE periods_out >= 1 AND periods_out <= 30 GROUP BY 1 ORDER BY 1
<div class="mode-header embed-hidden"> <h1>{{ title }}</h1> <p>{{ description }}</p> </div> <div class="mode-grid container"> <div class="row"> <div class="col-md-6"> <mode-chart id="chart_e024652dc30a" dataset="dataset" options="chart_options"></mode-chart> </div> <div class="col-md-6"> <mode-chart id="chart_7d7c90f2321e" dataset="dataset" options="chart_options"></mode-chart> </div> </div> </div>
{{ dataSourceName(params.queryId) }}

The dataset is too large to view in browser

Export

Looks like something went wrong with your query.

{{ DS.queryRuns[params.queryId].errorMessage }}
This query was cancelled