Query editor
WITH user_transactions AS (SELECT-- Identify the actual user's wallet based on the action typeCASEWHEN action_type = 'Deposit' THEN senderWHEN action_type = 'Withdrawal' THEN receiverEND AS user_wallet,action_type,tx_hashFROM dune.zerc20_analytics.result_zerc_20_database-- If using the new Dune engine, replace the line above with: FROM query_YOUR_QUERY_ID)SELECTuser_wallet,-- Total combined transactions for this walletCOUNT(DISTINCT tx_hash) AS total_transactions,-- Broken down by action typeCOUNT(DISTINCT CASE WHEN action_type = 'Deposit' THEN tx_hash END) AS total_deposits,COUNT(DISTINCT CASE WHEN action_type = 'Withdrawal' THEN tx_hash END) AS total_withdrawalsFROM user_transactionsWHERE user_wallet IS NOT NULLGROUP BY 1ORDER BY total_transactions DESC;