0-MIDweekly in vs out by tx count
    Updated 2023-03-15
    with act1 as (
    with tab1 as (
    select date_trunc('week',BLOCK_TIMESTAMP)as week,TX_FROM as active_user
    , count(distinct BLOCK_TIMESTAMP::date)as date
    from osmosis.core.fact_transactions
    group by 1,2
    having date>=5),
    tab2 as (
    select TX_FROM,TX_ID
    from osmosis.core.fact_transactions)
    select active_user, TX_ID
    from tab1
    left join tab2
    on tab1.active_user=tab2.TX_FROM),
    act2 as (
    select date_trunc('week',BLOCK_TIMESTAMP)as week,TX_ID
    , case
    when TRANSFER_TYPE='IBC_TRANSFER_IN' then 'Transfer IN'
    when TRANSFER_TYPE='IBC_TRANSFER_OUT' then 'Transfer OUT' end as transfer_state
    from osmosis.core.fact_transfers
    group by 1,2,3)
    select week,transfer_state,count(distinct act2.TX_ID) as transfer_tx
    from act1
    left join act2
    on act1.TX_ID=act2.TX_ID
    where transfer_state is not null
    group by 1,2

    Run a query to Download Data