Pmisha-bmlMdxTF.1
Updated 2022-03-24
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
›
⌄
with x1 as(
select
date_trunc('week',block_timestamp) as w1,
count(TX_STATUS) as all_transactions
from terra.transactions
where block_timestamp >= '2022-01-01'
group by 1
order by 1),
x2 as (
select
date_trunc('week',block_timestamp) as w2,
count(TX_STATUS) as fail_weekly
from terra.transactions
where block_timestamp >= '2022-01-01'
and TX_STATUS='FAILED'
group by 1
order by 1 )
SELECT
x1.w1 as wk,
all_transactions,
fail_weekly,
all_transactions-fail_weekly as success_wekly,
(fail_weekly/all_transactions)*100 as failure_rate,
sum(failure_rate) over (ORDER BY wk) as cum_failure_rate
from x1 full outer join x2 on x1.w1=x2.w2
group by 1,2,3,4
order by 1
Run a query to Download Data