Query editor
WITH per_event_hour AS (SELECT event_year, CAST(event_year AS VARCHAR) AS event_year_label, event_ts, event_window_hour, SUM(net_flow) AS net_usdc_flowFROM dune.dykdo0101.result_usdc_whale_fed_hourly_flows_2022_nowWHERE asset = 'USDC'GROUP BY 1,2,3,4)SELECT event_year_label, event_window_hour, AVG(net_usdc_flow) AS avg_net_usdc_flow, COUNT(DISTINCT event_ts) AS event_countFROM per_event_hourGROUP BY 1,2ORDER BY event_year_label, event_window_hour