select
date_trunc ('day',BLOCK_TIMESTAMP) as day,
COUNT(case when tx_succeeded = 'false' then 'Fail' end) as failed_tx,
COUNT(case when tx_succeeded = 'true' then 'Succeeded' end) as success_tx,
success_tx/failed_tx as Rate
from flow.core.fact_transactions
where tx_succeeded is not null and block_timestamp :: date >= '2022-01-01'
group by day
order by 1