Query editor
with deposits as (selectblock_time,tx_hash,tx_from,tx_to,sender,receiver,'Deposit' as event,asset_deposited as asset,symbol_deposited as symbol,amount_deposited as amountfrom query_6319858),withdrawals as (selectblock_time,tx_hash,tx_from,tx_to,sender,receiver,'Withdrawal' as event,asset_withdrawn as asset,symbol_withdrawn as symbol,share_withdrawn as amountfrom query_6319876),combined as (select * from depositsunion allselect * from withdrawals),base as (selecttx_from,coalesce(sum(case when event = 'Deposit' then amount end), 0) as amount_deposited,coalesce(sum(case when event = 'Withdrawal' then amount end), 0) as amount_withdrawn,coalesce(sum(case when event = 'Deposit' then amount end), 0) -coalesce(sum(case when event = 'Withdrawal' then amount end), 0) as net_amount_stakedfrom combinedgroup by 1)selectcount(distinct tx_from) as active_stakersfrom basewhere net_amount_staked > 0