Query editor
WITH sub_table_1 AS (SELECTdate,SUM(actual_depeg_evt) AS daily_actual_depeg,SUM(predicted_depegging_evt) AS daily_predict_depegFROM query_4093607GROUP BY 1ORDER BY 1),cumulative_depegs AS (SELECTdate,SUM(daily_actual_depeg) OVER (ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cumulative_actual_depeg,SUM(daily_predict_depeg) OVER (ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cumulative_predict_depegFROM sub_table_1),sub_table_2 AS (SELECTdate,ARRAY_JOIN(ARRAY_AGG(symbol ORDER BY symbol), ',') AS symbols_actual_depeg_evtFROM query_4093607WHERE actual_depeg_evt = 1GROUP BY date),sub_table_3 AS (SELECTdate,ARRAY_JOIN(ARRAY_AGG(symbol ORDER BY symbol), ',') AS symbols_predicted_depegging_evtFROM query_4093607WHERE predicted_depegging_evt = 1GROUP BY date)SELECTdate,cumulative_depegs.cumulative_actual_depeg,cumulative_depegs.cumulative_predict_depeg,sub_table_2.symbols_actual_depeg_evt,sub_table_3.symbols_predicted_depegging_evtFROM cumulative_depegsLEFT JOIN sub_table_2 USING (date)LEFT JOIN sub_table_3 USING (date)ORDER BY date DESC;