MahrooTotal Weekly Number of New Users and Active Users
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
›
⌄
with osmosis as ( select tx_from, trunc(block_timestamp,'week') as weeks
from osmosis.core.fact_transactions
where block_timestamp::date >= '2022-01-01'
)
,
weeks as ( select tx_from, count(weeks) as total_week
from osmosis
group by 1)
,
active as ( select tx_from
from weeks
where total_week >= 20)
,
users as ( select min(block_timestamp::date) as date, tx_from
from osmosis.core.fact_transactions
group by 2)
,
new_user as ( select date, count(DISTINCT(tx_from)) as total_new
from users
where date >= '2022-01-01'
group by 1)
select 'New User' as type, trunc(date,'week') as weekly, sum(total_new) as total, sum(total) over (order by weekly asc) as cum
from new_user
group by 1,2
UNION
select 'Active User' as type, trunc(block_timestamp,'week') as weekly, count(DISTINCT(tx_from)) as user,
sum(user) over (order by weekly asc) as cum
from osmosis.core.fact_transactions
where tx_from in (select tx_from from active)
and block_timestamp::date >= '2022-01-01'
group by 1,2
Run a query to Download Data