picasoUser Retention Analysis (Daily Cohort)1
Updated 2025-03-02Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
WITH first_seen AS (
SELECT
FROM_ADDRESS,
MIN(BLOCK_TIMESTAMP) AS first_tx_timestamp
FROM
boba.core.fact_traces
WHERE
BLOCK_TIMESTAMP >= DATEADD('year', -1, CURRENT_DATE)
GROUP BY
FROM_ADDRESS
),
user_retention AS (
SELECT
fs.FROM_ADDRESS,
DATE_TRUNC('day', fs.first_tx_timestamp) AS cohort_day,
COUNT(DISTINCT DATE_TRUNC('day', t.BLOCK_TIMESTAMP)) AS active_days,
DATEDIFF(
'day',
fs.first_tx_timestamp,
MAX(t.BLOCK_TIMESTAMP)
) AS days_retained
FROM
first_seen fs
JOIN boba.core.fact_traces t ON fs.FROM_ADDRESS = t.FROM_ADDRESS
GROUP BY
fs.FROM_ADDRESS,
fs.first_tx_timestamp
)
SELECT
cohort_day,
COUNT(DISTINCT from_address) AS cohort_size,
COUNT(
DISTINCT CASE
WHEN days_retained >= 1 THEN from_address
END
) AS d1_retained,
QueryRunArchived: QueryRun has been archived