Query editor
WITH token_transfers AS (SELECT"from" as address,SUM(CAST(value AS int256) * -1) as amountFROM erc20_ethereum.evt_TransferWHERE contract_address = {{token_address}}AND "from" <> 0x0000000000000000000000000000000000000000GROUP BY "from"UNION ALLSELECT"to" as address,SUM(CAST(value AS int256)) as amountFROM erc20_ethereum.evt_TransferWHERE contract_address = 0xAFF2565091E7207191dBe340B8528D02FA78d044AND "to" <> 0x0000000000000000000000000000000000000000GROUP BY "to"),holders AS (SELECTaddress,SUM(amount) as balanceFROM token_transfersGROUP BY addressHAVING SUM(amount) > 0),wallet_tx_counts AS (SELECTh.address,COUNT(*) as tx_countFROM holders hINNER JOIN ethereum.transactions tON h.address = t."from"GROUP BY h.address)SELECTCASEWHEN tx_count <= 5 THEN '0-5'WHEN tx_count <= 25 THEN '5-25'WHEN tx_count <= 50 THEN '25-50'WHEN tx_count <= 100 THEN '50-100'ELSE '100+'END as transaction_range,COUNT(*) as holder_countFROM wallet_tx_countsGROUP BYCASEWHEN tx_count <= 5 THEN '0-5'WHEN tx_count <= 25 THEN '5-25'WHEN tx_count <= 50 THEN '25-50'WHEN tx_count <= 100 THEN '50-100'ELSE '100+'ENDORDER BYCASE transaction_rangeWHEN '0-5' THEN 1WHEN '5-25' THEN 2WHEN '25-50' THEN 3WHEN '50-100' THEN 4