select split(pool_name, '-')[0] as poolname,
lp_action,
count (distinct tx_id) as Transactions,
count (distinct from_address) as Users,
sum (coalesce (rune_amount_usd,asset_amount_usd)) as Volume,
avg (coalesce (rune_amount_usd,asset_amount_usd)) as Average_Volume
from thorchain.defi.fact_liquidity_actions
where block_timestamp >= '2024-01-01'
and block_timestamp < date_trunc(week,current_date)
group by 1,2