TheLaughingManNEAR - Base retention
Updated 2023-10-23
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 near_users as (
select
block_timestamp,
tx_signer as user,
tx_hash
from near.core.fact_transactions
where 1=1
and TX_STATUS = 'Success'
and block_timestamp >= '2022-09-01'
UNION
select
block_timestamp,
tx_receiver as user,
tx_hash
from near.core.fact_transactions
where 1=1
and TX_STATUS = 'Success'
and block_timestamp >= '2022-09-01'
)
,
base_table as (
select
user
, date_trunc('month', block_timestamp) as date
, min(date_trunc('month', block_timestamp)) over(partition by user) as earliest_date
, datediff(
'month'
, min(date_trunc('month', block_timestamp)) over(partition by user) -- earliest_date
, date_trunc('month', block_timestamp) -- current date in month
) as difference
from near_users
where 1=1
)
, count_new_users as(
Run a query to Download Data