mmdrezaUntitled Query
    Updated 2022-10-17
    with tab1 as (
    select date_trunc (week,block_timestamp) as date,
    tx_from as Active_Users,
    count (distinct block_timestamp::date) as Days_Count
    from osmosis.core.fact_transactions
    where tx_status = 'SUCCEEDED'
    group by 1,2 having days_count >= 5),

    tab2 as (
    select 'Swap' as Action_Type,
    Trader as Users,
    count (distinct tx_id) as tx_count
    from osmosis.core.fact_swaps
    where tx_status = 'SUCCEEDED'
    group by 1,2)


    select action_type,
    case when tx_count = 1 then 'Once'
    when TX_Count > 1 and TX_Count <= 10 then '2 - 10 Times'
    when TX_Count > 10 then '11 - 25 Times'
    when TX_Count > 25 and TX_Count <= 50 then '26 - 50 Times'
    when TX_Count > 50 and TX_Count <= 100 then '51 - 100 Times'
    when TX_Count > 100 and TX_Count <= 250 then '101 - 250 Times'
    when TX_Count > 250 and TX_Count <= 500 then '251 - 500 Times'
    when TX_Count > 500 and TX_Count <= 1000 then '501 - 1000 Times'
    else 'More Than 1000 Times' end as type,
    count (distinct Users) as Users_Count
    from tab2
    group by 1,2
    order by 3 desc





    Run a query to Download Data