saeedmzn[Superwalk] - users activity overtime
Updated 2025-02-23
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 contracts AS (
SELECT contract_address, project, LABEL_TYPE
FROM $query('85327cc9-a796-46c4-a6a5-daf42d48dd23')
),
base_txns AS (
SELECT
DATE_TRUNC('month', BLOCK_TIMESTAMP) AS month,
ORIGIN_FROM_ADDRESS as user_address,
COUNT(DISTINCT tx_hash) as txn_count
FROM kaia.core.fact_event_logs
WHERE contract_address IN (SELECT contract_address FROM contracts)
GROUP BY 1, 2
),
user_first_tx AS (
SELECT
user_address,
MIN(month) as first_month
FROM base_txns
GROUP BY 1
),
monthly_metrics AS (
SELECT
b.month,
COUNT(DISTINCT b.user_address) as active_users,
COUNT(DISTINCT CASE WHEN b.month = f.first_month THEN b.user_address END) as new_users,
COUNT(DISTINCT CASE WHEN b.month > f.first_month THEN b.user_address END) as returning_users
FROM base_txns b
LEFT JOIN user_first_tx f ON b.user_address = f.user_address
GROUP BY 1
),
cumulative_users AS (
SELECT
QueryRunArchived: QueryRun has been archived