Query editor
WITH miners AS (SELECTDATE_TRUNC('month', call_block_time) AS month,_country,_cityFROM geod_console_polygon.MiningMachine_call_createSNWHEREcall_success = trueAND contract_address = 0x9410ac806a9024f11912f4d830fb91445bb21929AND call_block_time >= TIMESTAMP '2022-01-01'AND call_block_time < DATE_TRUNC('month', NOW()) + INTERVAL '1' MONTH),monthly_new AS (SELECTmonth,COUNT(*) AS new_minersFROM minersGROUP BY month),cumulative AS (SELECTm.month,COUNT(DISTINCT d._country) AS total_countries,COUNT(DISTINCT d._city) AS total_citiesFROM monthly_new mINNER JOIN miners d ON d.month <= m.monthGROUP BY m.month)SELECTc.month,n.new_miners,SUM(n.new_miners) OVER (ORDER BY c.month ASC) AS total_miners,c.total_countries,c.total_citiesFROM cumulative cINNER JOIN monthly_new n ON c.month = n.monthORDER BY c.month ASC;