theericstoneavalanche 3-month cohort retention
Updated 2024-04-22
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
›
⌄
-- forked from aptos 3-month cohort retention @ https://flipsidecrypto.xyz/edit/queries/f4d0d07f-4d82-4f21-9384-c349e00ae75c
-- forked from sei 3-month cohort retention copy @ https://flipsidecrypto.xyz/edit/queries/88356f9a-9024-4446-839f-a4b47a299d6c
-- forked from base 3-month cohort retention @ https://flipsidecrypto.xyz/edit/queries/7bd216c8-a88b-4f6e-a4d8-363f91df7d0b
WITH monthly_activity AS (
SELECT
DATE_TRUNC('month', block_timestamp) AS activity_month,
from_address as from_address,
COUNT(DISTINCT tx_hash) AS transaction_count
FROM
avalanche.core.fact_transactions
WHERE
block_timestamp >= CURRENT_DATE() - INTERVAL '1.5 years'
AND from_address NOT IN (
-- Exclude contract addresses
SELECT address FROM avalanche.core.dim_contracts
UNION
SELECT address from avalanche.core.dim_labels
-- Add additional subqueries to exclude centralized exchanges or protocols
)
GROUP BY
activity_month,
from_address
HAVING
COUNT(DISTINCT tx_hash) >= 2
),
cohorts AS (
SELECT
activity_month,
from_address
FROM
monthly_activity
),
QueryRunArchived: QueryRun has been archived