with active_users as
(
with joined_weeks as
(
SELECT
tx_from,
min(date_trunc('week', block_timestamp))::date as week_joined,
date_trunc('week', CURRENT_DATE) as current_week,
datediff('week', min(date_trunc('week', block_timestamp))::date, date_trunc('week', CURRENT_DATE)) as diff
from osmosis.core.fact_transactions
where block_timestamp <= '2022-10-16'
group by 1
-- limit 3
)
,
active_weeks as
(
SELECT
tx_from,
count(distinct week) as no_of_active_weeks
FROM
(
SELECT
date_trunc('week', block_timestamp) as week,
tx_from,
count(distinct block_timestamp::date) as no_of_active_days
from osmosis.core.fact_transactions
where block_timestamp <= '2022-10-16'
group by 1,2
having count(distinct block_timestamp::date) >= 4
)
group by 1
)
,