adriaparcerisasuser retention example
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 table_0 as (
select
trunc(a.block_timestamp,'month') as date_transaction,
signers[0] as from_address,
program_id
from solana.core.fact_transactions a
join solana.core.fact_events b on a.tx_id=b.tx_id
where a.block_timestamp >= '2022-01-01'
),
table_1 as (
Select first,program_id,
SUM(CASE WHEN month_number = 0 THEN 1 ELSE 0 END) AS cohort_0,
SUM(CASE WHEN month_number = 1 THEN 1 ELSE 0 END) AS cohort_1,
SUM(CASE WHEN month_number = 2 THEN 1 ELSE 0 END) AS cohort_2,
SUM(CASE WHEN month_number = 3 THEN 1 ELSE 0 END) AS cohort_3,
SUM(CASE WHEN month_number = 4 THEN 1 ELSE 0 END) AS cohort_4,
SUM(CASE WHEN month_number = 5 THEN 1 ELSE 0 END) AS cohort_5,
SUM(CASE WHEN month_number = 6 THEN 1 ELSE 0 END) AS cohort_6,
SUM(CASE WHEN month_number = 7 THEN 1 ELSE 0 END) AS cohort_7,
SUM(CASE WHEN month_number = 8 THEN 1 ELSE 0 END) AS cohort_8
from (
select m.from_address,m.program_id,m.login_month,n.first as first,
m.login_month-first as month_number from (SELECT
from_address, program_id, date_part(month,date_transaction) AS login_month FROM table_0
GROUP BY from_address,program_id,date_part(month,date_transaction)) m,(SELECT from_address, program_id,
min(date_part(month,date_transaction)) AS first FROM table_0 GROUP BY from_address,program_id)
n where m.from_address = n.from_address) as with_month_number
group by first,program_id order by first,program_id )
select
case when first = 1 then 'January'
when first = 2 then 'February'
when first = 3 then 'March'
Run a query to Download Data