hessNew Users Retention
Updated 2024-09-27
999
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 new as ( select block_timestamp,
sender
from aptos.core.fact_transactions
where SUCCESS = 'TRUE'
and block_timestamp::date >= '2023-01-01'
and TX_TYPE ilike '%user%'
)
,
base_table as ( select
sender as origin_from_address
, date_trunc('week', block_timestamp) as date
, min(date_trunc('week', block_timestamp)) over(partition by origin_from_address) as earliest_date
, datediff(
'week'
, min(date_trunc('week', block_timestamp)) over(partition by origin_from_address) -- earliest_date
, date_trunc('week', block_timestamp) -- current date in month
) as difference
from new
)
, count_new_users as(
select
earliest_date
, count(distinct origin_from_address) as new_users
from base_table
group by 1
)
, count_returning_users as(
select
earliest_date
, difference
, count(distinct origin_from_address) as existing_users
from base_table
where difference != 0
QueryRunArchived: QueryRun has been archived