with maintable as (
select proposal_id,
block_timestamp::date as date,
case when proposal_id = '362' then 'Proposal #362' else 'Other Recent Proposals' end as proposalID,
count (distinct tx_id) as Votes_Count,
count (distinct voter) as Voters_Count
from osmosis.core.fact_governance_votes
where proposal_id::numeric >= '300' and proposal_id::numeric <= '365'
and tx_status = 'SUCCEEDED'
group by 1,2,3)
select proposal_id,
proposalId,
avg (votes_count) as Average_Votes,
avg (voters_count) as Average_Voters_Count
from maintable
group by 1,2
order by 3 desc