Query editor
SELECTSUM(usd_dvn_fee) AS "Total DVN Fee",SUM(usd_executor_fee) AS "Total Executor Fee",SUM(usd_dvn_fee + usd_executor_fee) AS "Total Fees"FROMlayerzero.messagesWHEREproject = 'Stargate'AND -- This CASE statement still allows you to filter the totals by a time frameCASEWHEN '{{Time_Frame}}' = '1 Day' THEN ts_source >= now() - interval '1' dayWHEN '{{Time_Frame}}' = '7 Days' THEN ts_source >= now() - interval '7' dayWHEN '{{Time_Frame}}' = '30 Days' THEN ts_source >= now() - interval '30' dayWHEN '{{Time_Frame}}' = '90 Days' THEN ts_source >= now() - interval '90' dayWHEN '{{Time_Frame}}' = 'All' THEN TRUEEND;