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
›
⌄
with tpm as (
select
date_trunc('minute', block_timestamp) as mnt,
event_type,
count(distinct tx_id) as tx_cnt
from
flow.core.fact_events
where
TX_SUCCEEDED and block_timestamp > '2022-01-01'
group by 1, 2
)
select
date_trunc('month', mnt) as mont,
event_type,
avg(tx_cnt) as avtx,
avg(avtx) over (partition by event_type order by mont asc rows between 14 preceding and current row) as moving_avg_tx_cnt
from
tpm
group by 1, 2
having avtx > 5
order by 1 asc
Run a query to Download Data