select date_trunc ('day',BLOCK_TIMESTAMP) as day,
COUNT(case when STATUS = 'FAIL' then 'Fail' end) as failed_tx,
COUNT(case when STATUS = 'SUCCESS' then 'Succeeded' end) as success_tx,
success_tx/(failed_tx+success_tx) as Rate
from avalanche.core.fact_transactions
where STATUS is not null
and block_timestamp :: date >= CURRENT_DATE - 90
group by day
order by 1