Query editor
WITH transaction_daily AS (SELECTDATE_TRUNC('day', b.block_timestamp) AS transaction_day, (SUM(t.gas_used) * 0.000000000005) as revenue_eth_daily, COUNT(*) AS total_transactions, COUNT(CASE WHEN t.tx_code = 0 THEN 1 END) AS success_count, COUNT(CASE WHEN t.tx_code != 0 THEN 1 END) AS failed_countFROM yominet.transactions tLEFT JOIN yominet.blocks b ON b.block_height = t.block_heightWHERE t.chain_id = 'yominet-1'GROUP BY 1),daily_stats AS (SELECTtransaction_day AS day, revenue_eth_daily, SUM(revenue_eth_daily) OVER (ORDER BY transaction_day) AS cumulative_revenue_eth, total_transactions / 86400.0 AS tps, total_transactions AS transactions, SUM(total_transactions) OVER (ORDER BY transaction_day) AS cum_tx, AVG(total_transactions) OVER () AS daily_average, success_count, failed_countFROM transaction_daily)SELECTday, revenue_eth_daily, cumulative_revenue_eth, tps, transactions, 'Success' AS tx_status, success_count AS tx_count, cum_tx, daily_averageFROM daily_statsUNION ALLSELECTday, revenue_eth_daily, cumulative_revenue_eth, tps, transactions, 'Failed' AS tx_status, failed_count AS tx_count, cum_tx, daily_averageFROM daily_statsWHERE failed_count > 0ORDER BY day DESC, tx_status DESC;