Query editor
WITH first_appearance AS (SELECTmaker,MIN(DATE_TRUNC('day', evt_block_time)) AS first_active_dateFROM probable_v1_bnb.ctfexchange_evt_orderfilledGROUP BY maker),daily_stats AS (SELECTDATE_TRUNC('day', evt_block_time) AS date,COUNT(DISTINCT evt_tx_hash) AS unique_ctf_txns,COUNT(DISTINCT maker) AS unique_ctf_dau,ROUND(COUNT(DISTINCT evt_tx_hash)*1.0 / NULLIF(COUNT(DISTINCT maker), 0), 2) AS txn_user_ratio,COUNT(DISTINCT evt_tx_from) AS unique_tx_from,COUNT(maker) AS ctf_dauFROM probable_v1_bnb.ctfexchange_evt_orderfilledGROUP BY 1),daily_new_users AS (SELECTfirst_active_date AS date,COUNT(DISTINCT maker) AS new_usersFROM first_appearanceGROUP BY first_active_date)SELECTds.date,ds.unique_ctf_txns,ds.unique_ctf_dau,ds.txn_user_ratio,ds.unique_tx_from,ds.ctf_dau,COALESCE(dnu.new_users, 0) AS new_users,round(COALESCE(dnu.new_users, 0)*1.00 / ds.unique_ctf_dau*1.00 ,4)as new_user_ratioFROM daily_stats dsLEFT JOIN daily_new_users dnu ON ds.date = dnu.dateORDER BY ds.date DESC;