hessweekly New Vs. Old Users
Updated 2024-10-16
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 user_first_transaction AS (
SELECT
from_address,
MIN(block_timestamp) AS first_transaction_date
FROM
kaia.core.fact_transactions
GROUP BY
from_address
),
classified_transactions AS (
SELECT
t.tx_hash,
t.from_address,
t.block_timestamp,
CASE
WHEN t.block_timestamp = u.first_transaction_date THEN 'New User'
ELSE 'Old User'
END AS user_type
FROM
kaia.core.fact_transactions t
JOIN
user_first_transaction u
ON
t.from_address = u.from_address
)
SELECT
trunc(block_timestamp,'week') AS transaction_date,
user_type,
count(DISTINCT from_address) as users
FROM
classified_transactions
where block_timestamp::date >= '2022-01-01'
GROUP BY
1,2
ORDER BY
1,2
QueryRunArchived: QueryRun has been archived