Query editor
with data as (SELECTusr,borrow_amount_usd,supply_amount_usd,collat_amount_usd,timeFROM query_3957464WHERE blockchain = 'base'and loan_symbol = 'USDC'and usr IN (SELECT addressFROM base.creation_tracesWHERE "from" = 0x0BA5ED0c6AA8c49038F819E587E2633c4A9F428agroup by address)and time >= date '2025-01-27'),user_activity as (select date_trunc('week', first_used) as week,count(*) as first_usrsfrom (selectusr,min(time) as first_usedfrom datagroup by 1)group by 1)select *,CAST(first_usrs AS DOUBLE) / COALESCE(users, 0) AS first_usrs_pct,borrow_amt / COALESCE(users, 0) AS avg_borrow_per_user,collat_amt / COALESCE(borrow_amt, 0) AS collat_to_borrow_ratiofrom (select b.*,first_usrs,sum(first_usrs) over (order by b.week) as total_users,sum(borrow_amt) over (order by b.week) as total_borrow_amt,sum(supply_amt) over (order by b.week) as total_supply_amt,sum(collat_amt) over (order by b.week) as total_collat_amtfrom (select date_trunc('week', time) as week,count(distinct usr) as users,sum(borrow_amount_usd) as borrow_amt,sum(supply_amount_usd) as supply_amt,sum(collat_amount_usd) as collat_amtfrom data