Query editor
/* XDAO — Cumulative treasury inflow over time */WITH daos AS (SELECT DISTINCT chain, daoFROM xdao_v2_multichain.factory_evt_daocreatedWHERE chain IN ('ethereum','arbitrum','bnb','polygon')),m AS (SELECT date_trunc('month', t.block_date) AS mth,sum(t.amount_usd) AS inflowFROM tokens.transfers tJOIN daos d ON d.chain = t.blockchain AND d.dao = t.toLEFT JOIN daos s ON s.chain = t.blockchain AND s.dao = t."from"WHERE t.blockchain IN ('ethereum','arbitrum','bnb','polygon')AND t.block_date >= DATE '2021-11-01'AND t.amount_usd IS NOT NULLAND s.dao IS NULLGROUP BY 1)SELECTmth AS "Month",round(sum(inflow) OVER (ORDER BY mth)) AS "Cumulative inflow, USD",round(inflow) AS "Monthly inflow, USD"FROM mORDER BY 1