with prices as (select avg(PRICE) as p , SYMBOL from osmosis.core.dim_prices group by 2)
select (sum((from_amount /pow(10,from_decimal)) * p) / count(distinct trader)) as amount , PROJECT_NAME
from osmosis.core.fact_swaps
inner join osmosis.core.dim_labels
on from_currency=address
inner join prices
on PROJECT_NAME=SYMBOL
where (TO_CURRENCY not like '%pool%' or TO_CURRENCY is not null ) and from_decimal is not null and symbol!='IOV'
group by 2