Moeavax dau 13
    Updated 2023-10-20
    WITH daus as (
    SELECT
    distinct proposer as users,
    trunc(block_timestamp, 'week') as weeks,
    count(distinct trunc(block_timestamp, 'day')) as active_days
    from
    flow.core.fact_transactions
    group by
    1,
    2
    having
    active_days >= 4
    )

    select
    case
    when PROPOSER in (select users from daus) then 'DAU'
    else 'other'
    end as type,
    count(distinct e.tx_id) as txns,
    count(distinct PROPOSER) as users,

    sum (fee_usd) as total_fee_usd,
    total_fee_usd/txns as fee_per_txn,
    total_fee_usd/users as fee_per_user
    from flow.core.fact_transactions e
    join (
    select
    TX_ID,
    event_data:amount * avg(close) as fee_usd
    from
    flow.core.fact_events
    join flow.core.fact_hourly_prices on block_timestamp::Date = RECORDED_HOUR::date
    where
    event_type = 'FeesDeducted'
    Run a query to Download Data