tkvresearch2024-06-25 11:05 AM
    Updated 2024-07-03
    with full_table AS
    (select BLOCK_TIMESTAMP as datetime,
    tx_hash,
    address,
    case
    when BLOCK_TIMESTAMP = min(BLOCK_TIMESTAMP) over (partition by address order by BLOCK_TIMESTAMP) then 1
    else 0
    end as flag
    from
    (select BLOCK_TIMESTAMP,
    TX_HASH,
    FROM_ADDRESS as address
    from blast.core.fact_transactions
    where status = 'SUCCESS'
    union all
    select BLOCK_TIMESTAMP,
    TX_HASH,
    FROM_ADDRESS
    from blast.core.fact_transactions
    where status = 'SUCCESS'))

    select *
    from
    (select date,
    tx_cnt,
    cum_tx_cnt,
    (cum_tx_cnt/lag(cum_tx_cnt,7) over (order by date)-1)*100 as change_tx_7d,
    (cum_tx_cnt/lag(cum_tx_cnt,30) over (order by date)-1)*100 as change_tx_30d,
    user_cnt,
    cum_user_cnt,
    (cum_user_cnt/lag(cum_user_cnt,7) over (order by date)-1)*100 as change_user_7d,
    (cum_user_cnt/lag(cum_user_cnt,30) over (order by date)-1)*100 as change_user_30d,
    new_user,
    returning_user
    from
    (select date,
    QueryRunArchived: QueryRun has been archived