j-hackworthBy Week
Updated 2022-03-04Copy 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
›
⌄
WITH transactions AS (SELECT
DATE_TRUNC('week',block_timestamp) AS "WEEK",
from_address AS "Address"
FROM mdao_harmony.transfers
UNION
SELECT
DATE_TRUNC('week',block_timestamp) AS "WEEK",
to_address AS "Address"
FROM mdao_harmony.transfers
),
by_date AS(SELECT
"WEEK",
COUNT(distinct "WEEK"|| "Address") AS "# of Active Wallets"
FROM transactions
GROUP BY "WEEK"
ORDER BY "WEEK" DESC
)
SELECT
"WEEK",
"# of Active Wallets",
("# of Active Wallets" - LAG("# of Active Wallets",1) OVER (ORDER BY "WEEK")) / LAG("# of Active Wallets",1) OVER (ORDER BY "WEEK") AS "Percent Change"
FROM by_date AS b
ORDER BY "WEEK" DESC
Run a query to Download Data