Ali3NCorrelation of Transactions Volume & Average Transactions Fees
    Updated 2023-02-18
    with table1 as (
    select block_timestamp::date as date,
    case when block_number < 38189056 then 'Before Hard Fork'
    else 'After Hard Fork' end as timespan,
    count (distinct tx_hash) as TX_Count,
    count (distinct from_address) as Users_Count,
    sum (tx_fee) as Fees,
    avg (tx_fee) as Average_Fee,
    median (tx_fee) as Median_Fee,
    min (tx_fee) as Minimum_Fee,
    max (Tx_fee) as Maximum_Fee,
    count (case when STATUS != 'SUCCESS' then 1 end) as Failed_TX,
    count (case when STATUS = 'SUCCESS' then 1 end) as Success_TX,
    (Success_TX / (Success_TX + Failed_TX)) * 100 as Success_Rate
    from polygon.core.fact_transactions
    where block_timestamp >= '2022-12-17' and block_timestamp < '2023-02-18'
    group by 1,2),

    table2 as (
    select block_timestamp::date as date,
    case when block_number < 38189056 then 'Before Hard Fork'
    else 'After Hard Fork' end as timespan,
    sum (amount_usd) as Volume,
    avg (amount_usd) Average_Volume
    from polygon.core.ez_matic_transfers
    where block_timestamp>= '2022-12-17' and block_timestamp < '2023-02-18'
    group by 1,2)

    select t1.date,
    t1.timespan,
    volume,
    fees,
    average_fee,
    average_volume
    from table1 t1 join table2 t2 on t1.date = t2.date
    Run a query to Download Data