MLDZMNBTB6
    Updated 2023-02-01
    with t1 as (select
    tx_sender,
    count(date_trunc('day',block_timestamp)) as active_weeks
    from terra.core.fact_transactions
    group by 1
    ),

    t2 as (select
    distinct tx_sender
    from t1 where active_weeks>{{Active_weeks}}
    ),

    t3 as (select
    *
    from terra.core.fact_transactions
    where tx_sender in (select tx_sender from t2)
    )


    select
    date_trunc('week',block_timestamp) as date,
    case
    when tx_id in (select tx_id from terra.core.ez_staking) then 'Staking'
    when tx_id in (select tx_id from terra.core.ez_swaps) then 'Swapping'
    when tx_id in (select tx_id from terra.core.ez_transfers) then 'Transfer'
    when tx_id in (select tx_id from terra.core.fact_lp_actions) then 'Provide Liquidity'
    when tx_id in (select tx_id from terra.core.fact_governance_votes) then 'Voting'
    when tx_id in (select tx_id from terra.core.fact_nft_mints) then 'Minting NFTs'
    when tx_id in (select tx_id from terra.core.fact_nft_sales) then 'Trading NFTs'
    end as actions,
    count(distinct tx_id) as no_usage,
    count(distinct tx_sender) as no_users,
    sum(no_usage) over (partition by actions order by date) as total_usage
    from t3
    group by 1 , 2 having actions is not null
    Run a query to Download Data