crypto_king3New_Users
Updated 2024-11-13Copy Reference Fork
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 t as (
select
from_address as user,
min(block_timestamp::date) as created_at
from avalanche.core.fact_transactions
where to_address = lower('0xB8d7710f7d8349A506b75dD184F05777c82dAd0C')
group by from_address
),
t2 as (
select
created_at as day,
count(distinct user) as new_users
from t
group by created_at
),
t3 as (
select
block_timestamp::date as day,
count(distinct from_address) as total_users
from avalanche.core.fact_transactions
where to_address = lower('0xB8d7710f7d8349A506b75dD184F05777c82dAd0C')
group by block_timestamp::date
),
-- Calculating the cumulative metrics
metrics as (
select
t3.day,
total_users,
coalesce(t2.new_users, 0) as new_users,
sum(coalesce(t2.new_users, 0)) over (order by t3.day) as cumulative_new_users
from t3
left join t2 on t3.day = t2.day
)
QueryRunArchived: QueryRun has been archived