select
{{timeperiod}}(block_timestamp) as wk,
EVENT_TYPE as actions,
count(DISTINCT tx_id) as txs,
row_number() over (partition by wk order by txs desc) as row_no
from flow.core.fact_events
where block_timestamp::date >= '2022-01-01'
and block_timestamp::date < CURRENT_DATE - 1
group by 1,2
qualify row_no <= 10