messariNEAR Monthly Dapp User Retention
    Updated 2023-07-03
    with contracts as (
    select
    distinct t.tx_receiver as address,
    case
    when l.project_name is not null then l.project_name
    else t.tx_receiver
    end as contract_group
    from
    near.core.fact_transactions t
    left join
    near.core.dim_address_labels l
    on t.tx_receiver = l.address
    ),
    base as (
    SELECT
    DISTINCT
    date_trunc('MONTH', date(t.block_timestamp)) as month_active,
    t.tx_signer as address
    FROM
    near.core.fact_transactions t
    left join
    contracts c
    on t.tx_receiver = c.address
    where
    c.contract_group = '{{Dapp}}'
    ),
    user_cohort as (
    SELECT
    date_trunc('MONTH', min(date(t.block_timestamp))) as month_joined,
    t.tx_signer as address
    from
    near.core.fact_transactions t
    left join
    contracts c
    on t.tx_receiver = c.address
    where
    Run a query to Download Data