0xHaM-dQuarterly Validators
    Updated 2024-12-23
    select
    date_trunc('quarter', date) as "Date",
    case
    when year(date) = '2023' then concat('Q', quarter("Date"),'-','Months ','[',month("Date") ,' To ',month("Date") + 2,']','-', 23 )
    when year(date) = '2024' then concat('Q', quarter("Date"),'-','Months ','[',month("Date") ,' To ',month("Date") + 2,']','-', 24 )
    end as "Quarter",
    CASE when year(date) = '2023' then 'y.2023' else 'y.2024' end as year,
    count(distinct address) as validators_count,
    sum(balance) as total_balance,
    round(((validators_count / lag(validators_count) over (order by "Date")) - 1) * 100) AS "Change in # Validators in Percent",
    round(((total_balance / lag(total_balance) over (order by "Date")) - 1) * 100) AS "Change in Balance in Percent"
    from near.gov.fact_staking_pool_daily_balances
    where year(date) = '2024'
    -- AND date < '2024-10-01'
    GROUP by 1,2,3



    QueryRunArchived: QueryRun has been archived