SELECT
date_trunc('week', block_timestamp) as week,
COUNT(tx_id) as Total_Transactions_Weekly,
SUM(fee) as Total_Fees_Weekly,
Total_Fees_Weekly/ Total_Transactions_Weekly as AVG_Transaction_Fee_Weekly,
Total_Transactions_Weekly / 604800 as TPS_Weekly,
Count(block_id) as Total_Block_ID,
604800 / Total_Block_ID as AVG_Block_Time
From terra.core.fact_transactions
where TX_SUCCEEDED ilike 'TRUE'
And BLOCK_TIMESTAMP >= '2022-01-01'
group by 1