Query editor
withkelp_base as (select *,staker as userfrom query_4008598-- from dune.maybeyonas.result_baby_actionswhere babylon_acceptance = 'accepted'),first_use as (selectuser,min(block_time) as first_time,'new depositor' as user_typefrom kelp_basegroup by 1),usr_return_or_not as (selecta.*,coalesce(user_type,'returning depositor') as user_typefrom kelp_base a left join first_use fon a.user=f.userand date_trunc('day', a.block_time) = date_trunc('day', f.first_time)),user_info as (selectdate_trunc('day',block_time) as date,-- user_type,count(distinct (case when user_type='new depositor' then user else null end)) as new_depositors,count(distinct case when user_type!='new depositor' then user else null end) as returning_depositors,count(distinct user) as active_depositors,sum(count(distinct case when user_type='new depositor' then user else null end)) over (order by date_trunc('day',block_time)) as depositors_growthfrom usr_return_or_notgroup by 1)selectdate,new_depositors,returning_depositors,depositors_growth,active_depositors,-- cast(new_depositors as double)/cast(depositors_growth as double) as growth_diff_1d,100.0*(cast(new_depositors as double)/cast(depositors_growth as double)) as growth_diff_1d,-- active_depositors/(depositors_growth-active_depositors) as growth_percent((depositors_growth /lag(depositors_growth, 7) over(order by date))-1)*100 as growth_diff_7dfrom user_infoorder by 1 desc