Query editor
WITH all_transfers AS (SELECT "from" AS address, -CAST(value AS DOUBLE)/1e18 AS amountFROM erc20_ethereum.evt_transferWHERE contract_address = 0x73A15FeD60Bf67631dC6cd7Bc5B6e8da8190aCF5AND "from" != 0x0000000000000000000000000000000000000000AND "from" != 0x7fda203f6f77545548e984133be62693bcd61497AND "from" != 0x1d08e7adc263cfc70b1babe6dc5bb339c16eec52AND "from" != 0x14100f81e33c33ecc7cdac70181fb45b6e78569fAND "from" != 0x35d8949372d46b7a3d5a56006ae77b215fc69bc0UNION ALLSELECT "to" AS address, CAST(value AS DOUBLE)/1e18 AS amountFROM erc20_ethereum.evt_transferWHERE contract_address = 0x73A15FeD60Bf67631dC6cd7Bc5B6e8da8190aCF5AND "to" != 0x0000000000000000000000000000000000000000AND "to" != 0x7fda203f6f77545548e984133be62693bcd61497AND "to" != 0x1d08e7adc263cfc70b1babe6dc5bb339c16eec52AND "to" != 0x14100f81e33c33ecc7cdac70181fb45b6e78569fAND "to" != 0x35d8949372d46b7a3d5a56006ae77b215fc69bc0UNION ALL--0x7fda203f6f77545548e984133be62693bcd61497select address,amtfrom query_4191600UNION ALL--0x1d08e7adc263cfc70b1babe6dc5bb339c16eec52select address,amtfrom query_4187188UNION ALL--0x14100f81e33c33ecc7cdac70181fb45b6e78569fselect address,amtfrom query_4196062UNION ALL--0x35d8949372d46b7a3d5a56006ae77b215fc69bc0select address,amtfrom query_4197182UNION ALLselect "from" AS address, CAST(value AS DOUBLE)/1e18 AS amountfrom erc20_ethereum.evt_transferWHERE contract_address = 0x35D8949372D46B7a3D5A56006AE77B215fc69bC0AND "to" = 0xeda663610638e6557c27e2f4e973d3393e844e70AND "from" = 0xa10d05e5582abdf37b991d0b1fb5616358fbf3a8),aggregated_data AS (SELECT address, SUM(amount) AS amtFROM all_transfersGROUP BY addressHAVING SUM(amount) > 0),total_sum AS (SELECT SUM(amt) AS total_amountFROM aggregated_data),all as (SELECT a.address, a.amt,(a.amt / ts.total_amount) AS percentageFROM aggregated_data a, total_sum ts),other_bal as (SELECTaddress, total_balance as ot_bal