Query editor
WITH m AS (SELECT date_trunc('month', at_timezone(time_uk, 'Europe/London')) AS month, dvn_type, min(dvn_type_sort) AS s,count_if(change = 'ADDED') AS added, count_if(change = 'REMOVED') AS removedFROM dune.canaryone.result_cpops_dvntype_logWHERE test_flag = ''GROUP BY 1, 2)SELECT cast(month AS date) AS month, dvn_type || ' added' AS series, added AS routes, s * 2 - 1 AS sort_key FROM m WHERE added > 0UNION ALLSELECT cast(month AS date), dvn_type || ' removed', -removed, s * 2 FROM m WHERE removed > 0ORDER BY 1, 4