Query editor
WITH user_segments AS (SELECTt."from" AS from_address,COUNT(*) AS tx_count,COUNT(DISTINCT DATE_TRUNC('day', b.time)) AS active_days,AVG(t.gas_used) AS avg_gas_used,MIN(b.time) AS first_tx,MAX(b.time) AS last_txFROM ink.transactions AS tJOIN ink.blocks AS bON t.block_number = b.numberGROUP BY1)SELECTCASEWHEN tx_count >= 100THEN 'Power User'WHEN tx_count >= 10THEN 'Regular User'ELSE 'Casual User'END AS user_segment,COUNT(*) AS user_count,AVG(tx_count) AS avg_transactions,AVG(active_days) AS avg_active_daysFROM user_segmentsGROUP BY1