with votes as (
select
voter,
count (distinct tx_id) as votes_count,
count (distinct voter) as voters_count,
proposal_id
from osmosis.core.fact_governance_votes
where tx_status = 'SUCCEEDED'
and proposal_id > 350
group by 1, 4)
select
avg(balance/pow(10,6)) as AVG_OSMO_Balance,
proposal_id
from osmosis.core.fact_daily_balances b inner join votes v on b.address = v.voter
where currency = 'uosmo'
--and address in (select voter from votes)
group by proposal_id