Query editor
-- Cumulative reward distribution. Dashboard title: test-- Reads payouts_attributed.sql; replace query_0000000 with its Dune query id.---- Cumulative wallets cannot be a running sum of the daily distinct count -- the-- same wallet is paid on most days. It is the running sum of wallets seen for the-- first time, which is what first_seen gives.WITH daily AS (SELECTday,sum(amount) AS quote_distributed,count(*) AS payoutsFROM query_8659279GROUP BY 1),first_seen AS (SELECT wallet, min(day) AS dayFROM query_8659279GROUP BY 1),new_wallets AS (SELECT day, count(*) AS new_walletsFROM first_seenGROUP BY 1)SELECTd.day,d.quote_distributed,sum(d.quote_distributed) OVER (ORDER BY d.day) AS cumulative_quote,coalesce(n.new_wallets, 0) AS new_wallets,sum(coalesce(n.new_wallets, 0)) OVER (ORDER BY d.day) AS cumulative_wallets,d.payouts,sum(d.payouts) OVER (ORDER BY d.day) AS cumulative_payoutsFROM daily dLEFT JOIN new_wallets n ON n.day = d.dayORDER BY d.day