adriaparcerisasdau aptos 2.2
Updated 2024-12-13
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
news AS (
SELECT
DISTINCT sender,
MIN(TRUNC(block_timestamp, 'week')) AS debut
FROM aptos.core.fact_transactions
GROUP BY 1
),
daus AS (
SELECT
DISTINCT sender AS users,
TRUNC(block_timestamp, 'week') AS weeks,
COUNT(DISTINCT TRUNC(block_timestamp, 'day')) AS active_days
FROM aptos.core.fact_transactions
GROUP BY 1, 2
HAVING active_days >= 4
),
active_users AS (
SELECT
debut AS date,
CASE WHEN sender IN (SELECT users FROM daus) THEN 'DAU'
ELSE 'No DAU' END AS type,
COUNT(DISTINCT sender) AS n_userss
FROM news
GROUP BY 1, 2
),
daus_summary AS (
SELECT date, n_userss AS daus
FROM active_users
WHERE date >= current_date - INTERVAL '{{Months}} MONTHS'
AND date < TRUNC(current_date, 'week')
AND type = 'DAU'
ORDER BY 1 ASC
),
nondaus_summary AS (
SELECT date, n_userss AS nondaus
QueryRunArchived: QueryRun has been archived