-- forked from Avalanche CEX Flows - Origin from Users #2 without unlabeled @ https://flipsidecrypto.xyz/edit/queries/e60b902f-7c79-4343-ba25-1f987c533eb1
with cte as (
SELECT
project_name as type,
to_address as user,
min(block_timestamp) as min_date
from avalanche.core.fact_transactions join avalanche.core.dim_labels on from_address = address
where label_type = 'cex'
group by 1,2)
SELECT
type as "Funding Platform",
count(distinct user) as "Users"
from cte
group by 1