elsina2024-08-19: Monthly new_user
Updated 2024-10-19
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 users as (
SELECT
signer_id as user,
min(block_timestamp) as min_date
from
near.gov.fact_staking_actions
where
action in ('staking', 'unstaking')
group by
user
),
new_users as (
select
date_trunc('month', min_date) as date,
count(distinct user) as new_user_count
from
users
group by
date
),
old_users as (
select
date_trunc('month', block_timestamp) as date,
count(distinct
case
when signer_id in (select user from users where date_trunc('month', min_date) = date_trunc('month', block_timestamp))
then null
else signer_id
end
) as old_user_count,
count(distinct signer_id) as total_user_count
from
near.gov.fact_staking_actions
where
action in ('staking', 'unstaking')
group by
QueryRunArchived: QueryRun has been archived