with tab as (
select date_trunc ('week',block_timestamp) as date,
trader as traders,
count (distinct tx_id) as transactions_count
from osmosis.core.fact_swaps
where tx_status = 'SUCCEEDED'
group by 1,2
having transactions_count >= 20)
select
project_name,
count(DISTINCT trader) as actvie_users
from osmosis.core.fact_swaps
left outer join osmosis.core.dim_labels
on from_currency = address
where trader in (select traders from tab)
GROUP BY 1 order by 2 desc
limit 10