NavidCopy of Untitled Query
Updated 2022-12-09Copy Reference Fork
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
31
32
33
34
›
⌄
with suctpm as (
select
date_trunc('minute', block_timestamp) as mnt,
'Succesful' as type,
count(distinct tx_id) as tx_cnt
from
flow.core.fact_transactions
where
TX_SUCCEEDED and block_timestamp >= '2022-01-01'
group by 1
), failtpm as (
select
date_trunc('minute', block_timestamp) as mnt,
'Failed' as type,
count(distinct tx_id) as tx_cnt
from
flow.core.fact_transactions
where
(not TX_SUCCEEDED) and block_timestamp >= '2022-01-01'
group by 1
), alltpm as (
select * from suctpm
union all
select * from failtpm
)
select
date_trunc('week', mnt) as mont,
type,
avg(tx_cnt) as avtx,
avg(avtx) over (order by mont asc rows between 14 preceding and current row) as moving_avg_tx_cnt
from
alltpm
group by 1, 2
order by 1 asc
Run a query to Download Data