Query editor
SELECT DATE(block_time) as day, 'eth' as asset_id, sum(tx_fee) as total_tx_feesFROM(SELECT hash, gas_price, gas_used, (cast(gas_price as double)*cast(gas_used as double))/POW(10,18) as tx_fee, block_timeFROM ethereum.transactionswhere date_trunc('day', block_time) >= TIMESTAMP {{start_of_month}}and date_trunc('day', block_time) <= TIMESTAMP {{end_of_month}}) feesGROUP BY 1UNION ALLSELECT DATE(block_time) as day, 'matic' as asset_id, sum(tx_fee) as total_tx_feesFROM(SELECT hash, gas_price, gas_used, (cast(gas_price as double)*cast(gas_used as double))/POW(10,18) as tx_fee, block_timeFROM polygon.transactionswhere date_trunc('day', block_time) >= TIMESTAMP {{start_of_month}}and date_trunc('day', block_time) <= TIMESTAMP {{end_of_month}}) feesGROUP BY 1UNION ALLSELECT DATE(block_time) as day, 'avax' as asset_id, sum(tx_fee) as total_tx_feesFROM(SELECT hash, gas_price, gas_used, (cast(gas_price as double)*cast(gas_used as double))/POW(10,18) as tx_fee, block_timeFROM avalanche_c.transactionswhere date_trunc('day', block_time) >= TIMESTAMP {{start_of_month}}and date_trunc('day', block_time) <= TIMESTAMP {{end_of_month}}) feesGROUP BY 1UNION ALLSELECT DATE(block_time) as day, 'ftm' as asset_id, sum(tx_fee) as total_tx_feesFROM(SELECT hash, gas_price, gas_used, (cast(gas_price as double)*cast(gas_used as double))/POW(10,18) as tx_fee, block_timeFROM fantom.transactionswhere date_trunc('day', block_time) >= TIMESTAMP {{start_of_month}}and date_trunc('day', block_time) <= TIMESTAMP {{end_of_month}}) feesGROUP BY 1UNION ALLSELECT DATE(block_time) as day, 'celo' as asset_id, sum(tx_fee) as total_tx_feesFROM(SELECT hash, gas_price, gas_used, (cast(gas_price as double)*cast(gas_used as double))/POW(10,18) as tx_fee, block_timeFROM celo.transactionswhere date_trunc('day', block_time) >= TIMESTAMP {{start_of_month}}and date_trunc('day', block_time) <= TIMESTAMP {{end_of_month}}) feesGROUP BY 1UNION ALLSELECT DATE(block_time) as day, 'op' as asset_id, sum(tx_fee) as total_tx_feesFROM(SELECT hash, gas_price, gas_used,((cast(gas_price as double)*cast(gas_used as double))+(cast(l1_gas_price as double)*cast(l1_gas_used as double)*cast(l1_fee_scalar as double)))/POW(10,18) as tx_fee,block_timeFROM optimism.transactionswhere date_trunc('day', block_time) >= TIMESTAMP {{start_of_month}}and date_trunc('day', block_time) <= TIMESTAMP {{end_of_month}}) fees