brian-terraF e Arbitrum copy
    Updated 2023-10-11
    -- forked from Sajjadiii / F e Arbitrum @ https://flipsidecrypto.xyz/Sajjadiii/q/WDQDddlAF1ZZ/f-e-arbitrum

    WITH base as (
    SELECT date_trunc('month',block_timestamp::date) AS date ,
    COUNT(DISTINCT TX_HASH) AS tx_count ,
    (SELECT COUNT(DISTINCT TX_HASH)/1440 FROM arbitrum.core.fact_transactions WHERE block_timestamp >= '2023-01-01' AND block_timestamp < '2023-02-01'and STATUS = 'SUCCESS' ) AS jan_tpm ,
    (SELECT COUNT(DISTINCT TX_HASH)/1440 FROM arbitrum.core.fact_transactions WHERE block_timestamp >= '2023-07-01' AND block_timestamp < '2023-08-01'and STATUS = 'SUCCESS' ) AS jul_tpm ,
    (SELECT COUNT(DISTINCT TX_HASH)/1440 FROM arbitrum.core.fact_transactions WHERE block_timestamp >= '2023-09-01' AND block_timestamp < '2023-10-01'and STATUS = 'SUCCESS' ) AS sept_tpm ,
    COUNT(DISTINCT BLOCK_NUMBER) AS block_count,
    tx_count / block_count AS tx_per_block,
    (block_count/24) block_per_hour,
    (tx_count/86400) AS TPS,
    (tx_count/1440) as TPM,
    (tx_count/24) AS TPH ,
    Lag(TPM) OVER (ORDER BY date) AS lag ,
    TPM - lag AS change,
    change*100 / TPM AS change_perc
    from Arbitrum.core.fact_transactions
    where block_timestamp >= '2023-01-01'
    AND block_timestamp < '2023-10-01'
    and STATUS = 'SUCCESS'
    group by 1
    order by 1
    )
    SELECT * FROM base