Afonso_DiazUntitled Query
    Updated 2023-01-23
    with t as (
    select
    voter,
    min(block_timestamp)::date as min_date
    from terra.core.fact_governance_votes
    where tx_succeeded = 1
    group by 1
    ),

    t2 as (
    select
    proposal_id,
    min(block_timestamp)::date as min_date
    from terra.core.fact_governance_votes
    where tx_succeeded = 1
    group by 1
    )

    select
    count(distinct tx_id) as votes_count,
    count(distinct t2.proposal_id) as new_proposals_count,
    count(distinct a.proposal_id) as active_proposals_count,
    count(distinct t.voter) as new_voters_count,
    count(distinct a.voter) as voters_count
    from terra.core.fact_governance_votes a
    left join t on a.block_timestamp::date = t.min_date
    left join t2 on a.block_timestamp::date = t2.min_date
    where a.block_timestamp > current_date - interval '1 month'
    Run a query to Download Data