select a.* from
(select date,address,balance/pow(10,6) as blnc, rank() over (partition by date order by balance/pow(10,6) desc) as rnk
from osmosis.core.fact_daily_balances
where currency = 'uosmo'
and date_trunc('month',date) = date
and balance/pow(10,6) > 0) as a