Query editor
-- One row. Each counter visualization picks a different column off this single-- execution. USD columns are provided raw and scaled to millions (_m) so the-- counter tiles can render "$31.12M" instead of a nine-digit number.-- Filter with the {{wallet}} parameter.WITH base AS (SELECT *FROM dune.talma.result_wallet_flow_transfersWHERE NOT is_internalAND ('{{wallet}}' = 'All wallets' OR wallet_label = '{{wallet}}')),agg AS (SELECT-- all timeCOUNT(DISTINCT tx_hash) AS txns_all,COALESCE(SUM(amount_usd) FILTER (WHERE direction = 'inflow'), 0) AS inflow_usd_all,COALESCE(SUM(amount_usd) FILTER (WHERE direction = 'outflow'), 0) AS outflow_usd_all,COALESCE(SUM(amount_usd), 0) AS gross_usd_all,COUNT(DISTINCT counterparty) AS counterparties_all,-- rolling 30 daysCOUNT(DISTINCT CASE WHEN block_date >= CURRENT_DATE - INTERVAL '30' DAYTHEN tx_hash END) AS txns_30d,COALESCE(SUM(amount_usd) FILTER (WHERE direction = 'inflow'AND block_date >= CURRENT_DATE - INTERVAL '30' DAY), 0) AS inflow_usd_30d,COALESCE(SUM(amount_usd) FILTER (WHERE direction = 'outflow'AND block_date >= CURRENT_DATE - INTERVAL '30' DAY), 0) AS outflow_usd_30d,COALESCE(SUM(amount_usd) FILTER (WHERE block_date >= CURRENT_DATE - INTERVAL '30' DAY), 0) AS gross_usd_30d,COUNT(DISTINCT CASE WHEN block_date >= CURRENT_DATE - INTERVAL '30' DAYTHEN counterparty END) AS counterparties_30dFROM base)SELECTtxns_all,inflow_usd_all,outflow_usd_all,gross_usd_all,counterparties_all,txns_30d,inflow_usd_30d,outflow_usd_30d,gross_usd_30d,counterparties_30d,-- display-scaled (millions)inflow_usd_all / 1e6 AS inflow_usd_all_m,outflow_usd_all / 1e6 AS outflow_usd_all_m,gross_usd_all / 1e6 AS gross_usd_all_m,inflow_usd_30d / 1e6 AS inflow_usd_30d_m,outflow_usd_30d / 1e6 AS outflow_usd_30d_m,gross_usd_30d / 1e6 AS gross_usd_30d_mFROM agg