select
date_trunc('day',BLOCK_TIMESTAMP) as day
,count (case when STATUS <> 'SUCCESS' then 1 end) as failed_txs
,count (case when STATUS = 'SUCCESS' then 1 end) as success_txs
,(failed_txs / (success_txs + failed_txs)) * 100 as "% Failure Rate"
,count(distinct TX_HASH)/1440 as tpm
from bsc.core.fact_transactions
where BLOCK_TIMESTAMP>='2022-01-01'
and BLOCK_TIMESTAMP<>current_date
group by 1