with table_1 as (select block_timestamp, tx_id, value as pool_id
from osmosis.core.fact_swaps, table(flatten(input => pool_ids)) where tx_status = 'SUCCEEDED')
select pool_id, min(date_trunc('day', block_timestamp)) as day, 1 as pool_number,
sum(pool_number) over (order by day) as cum
from table_1 group by pool_id having day >= '2022-05-01'