MahrooUntitled Query
    Updated 2022-11-06
    with t1 as
    (
    select
    count(case when ORIGIN_FUNCTION_SIGNATURE='0x' then 1 else null end) as transaction_number_0x,
    count(case when ORIGIN_FUNCTION_SIGNATURE!='0x' then 1 else null end) as transaction_number_other,

    sum(case when ORIGIN_FUNCTION_SIGNATURE='0x' then ETH_VALUE else null end) as eth_volume_0x,
    sum(case when ORIGIN_FUNCTION_SIGNATURE!='0x' then ETH_VALUE else null end) as eth_volume_other,

    sum(case when ORIGIN_FUNCTION_SIGNATURE='0x' then GAS_USED else null end) as gas_used_0x,
    sum(case when ORIGIN_FUNCTION_SIGNATURE!='0x' then GAS_USED else null end) as gas_used_other,

    count(case when ORIGIN_FUNCTION_SIGNATURE='0x' and STATUS='SUCCESS' then 1 else null end)/count(case when ORIGIN_FUNCTION_SIGNATURE='0x' then 1 else null end) as success_rate_0x,
    count(case when STATUS='SUCCESS' then 1 else null end)/count(*) as "Total success rate",


    date_trunc('week', BLOCK_TIMESTAMP) as date
    from ethereum.core.fact_transactions

    group by date)

    select
    *,
    sum(TRANSACTION_NUMBER_0X) over (order by date) as cumulative_TRANSACTION_NUMBER_0X,
    sum(ETH_VOLUME_0X) over (order by date) as cumulative_ETH_VOLUME_0X,
    sum(GAS_USED_0X) over (order by date) as cumulative_GAS_USED_0X

    from t1
    Run a query to Download Data