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