Afonso_DiazNew / Active users + Retention Rate
Updated 2025-03-06
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
main as (
select
tx_hash,
block_timestamp,
from_address as user,
tx_fee
from
ink.core.fact_transactions
where
tx_succeeded
),
weekly_users as (
select
date_trunc('week', block_timestamp) as week,
user,
min(block_timestamp) over (partition by user) as first_seen
from main
),
weekly_metrics as (
select
week,
count(distinct user) as active_users,
count(distinct case when date_trunc('week', first_seen) = week then user end) as new_users,
count(distinct case when date_trunc('week', first_seen) < week then user end) as returning_users
from weekly_users
group by week
),
retention as (
select
w1.week as current_week,
w2.week as previous_week,
QueryRunArchived: QueryRun has been archived