Query editor
SELECTdate_trunc('month', t.block_time) AS month,COUNT(*) AS tx_count,SUM(CASEWHEN t."type" = 'Legacy' THEN (CAST(t.gas_used AS double) * t.gas_price) / 1e18WHEN t."type" = 'DynamicFee' THEN (CAST(t.gas_used AS double) * (b.base_fee_per_gas + t.priority_fee_per_gas)) / 1e18END) AS fees,SUM(CAST(t.gas_used AS double)) as gas_used,SUM(CASEWHEN t."type" = 'Legacy' THEN (t.gas_price) / 1e18WHEN t."type" = 'DynamicFee' THEN (b.base_fee_per_gas + t.priority_fee_per_gas) / 1e18END) AS gas_price,SUM(CASEWHEN t."type" = 'Legacy' THEN (CAST(t.gas_used AS double) * t.gas_price) / 1e18 * p.priceWHEN t."type" = 'DynamicFee' THEN (CAST(t.gas_used AS double) * (b.base_fee_per_gas + t.priority_fee_per_gas)) / 1e18 * p.priceEND) AS fees_usd,AVG(CASEWHEN t."type" = 'Legacy' THEN (CAST(t.gas_used AS double) * t.gas_price) / 1e18 * p.priceWHEN t."type" = 'DynamicFee' THEN (CAST(t.gas_used AS double) * (b.base_fee_per_gas + t.priority_fee_per_gas)) / 1e18 * p.priceEND) AS avg_fee_usd,approx_percentile(CASEWHEN t."type" = 'Legacy' THEN (CAST(t.gas_used AS double) * t.gas_price) / 1e18 * p.priceWHEN t."type" = 'DynamicFee' THEN (CAST(t.gas_used AS double) * (b.base_fee_per_gas + t.priority_fee_per_gas)) / 1e18 * p.priceEND,0.5) AS median_fee_usd,'Ethereum' AS chainFROM ethereum.transactions tINNER JOIN ethereum.blocks b ON t.block_number = b.numberLEFT JOIN prices.usd p ON p.blockchain IS NULL AND p.symbol = 'ETH' AND p.minute = date_trunc('minute', t.block_time)GROUP BY 1