Updated 2023-02-05
    with info as (
    select
    date_trunc('day', block_timestamp) as "Day",
    block_id,
    count(distinct tx_hash) as "TX Count"
    from near.core.fact_transactions
    where "Day" between current_date - 14 and current_date - 7
    group by 1, 2
    ),
    TPB as (
    select
    "Day",
    avg("TX Count") as "TPB"
    from info
    group by 1
    ),
    avg_info as (
    select
    avg("TPB") as "AVG TPB"
    from TPB
    )
    select *
    from TPB, avg_info
    order by "Day"
    Run a query to Download Data