NavidCopy of Untitled Query
    Updated 2022-12-09
    with suctpm as (
    select
    date_trunc('minute', block_timestamp) as mnt,
    'Succesful' as type,
    count(distinct tx_id) as tx_cnt
    from
    flow.core.fact_transactions
    where
    TX_SUCCEEDED and block_timestamp >= '2022-01-01'
    group by 1
    ), failtpm as (
    select
    date_trunc('minute', block_timestamp) as mnt,
    'Failed' as type,
    count(distinct tx_id) as tx_cnt
    from
    flow.core.fact_transactions
    where
    (not TX_SUCCEEDED) and block_timestamp >= '2022-01-01'
    group by 1
    ), alltpm as (
    select * from suctpm
    union all
    select * from failtpm
    )
    select
    date_trunc('week', mnt) as mont,
    type,
    avg(tx_cnt) as avtx,
    avg(avtx) over (order by mont asc rows between 14 preceding and current row) as moving_avg_tx_cnt
    from
    alltpm
    group by 1, 2
    order by 1 asc
    Run a query to Download Data