select date_trunc('month', block_timestamp::date) as "Date (Month)"
, sum(case when action = 'pool_joined' then amount/1e6 else 0 end) as "pool joined Osmo"
, sum(case when action = 'pool_exited' then amount/1e6 else 0 end) as "pool exited Osmo"
, sum(case when action = 'pool_joined' then amount/1e6 else 0 end)
- sum(case when action = 'pool_exited' then amount/1e6 else 0 end) as "pool Osmo"
from osmosis.core.fact_liquidity_provider_actions
where block_timestamp::date >= '2022-01-01'
and currency = 'uosmo'
group by 1
order by 1