SocioCryptonew users vs old users
    Updated 2023-05-01
    SELECT
    y.date as date,
    z.unique_wallet as n_unique_new_wallet,
    z.total_txs as total_tnxs_new,
    y.wallet as n_unique_wallet,
    total_tnxs_new/n_unique_wallet as avg_txn_new
    FROM
    (
    SELECT date_trunc('day',first_tx) as first_tx_date,
    COUNT(DISTINCT wallet) as unique_wallet,
    sum(n_txs) AS total_txs
    FROM
    (
    SELECT tx_sender AS wallet,
    min(block_timestamp) as first_tx,
    COUNT(DISTINCT tx_id) as n_txs
    from terra.core.fact_transactions p
    GROUP BY wallet
    HAVING first_tx between CURRENT_DATE -91 and CURRENT_DATE -1
    )
    group BY first_tx_date
    order BY first_tx_date
    ) z
    full JOIN
    (
    SELECT date_trunc('day',block_timestamp) as date,
    count( DISTINCT tx_sender) as wallet, --,
    count(distinct tx_id) as n_txs,
    n_txs/wallet as avg_txn
    from terra.core.fact_transactions
    WHERE date between current_date - 91 and CURRENT_DATE -1
    group BY date
    )y
    on y.date = z.first_tx_date
    ORDER by date
    Run a query to Download Data