Query editor
withday_address_base as(SELECTaddress as address,day,sum(value) as cumulative_balancefrom(SELECTto AS address,DATE_TRUNC('day', evt_block_time) AS day,SUM(value / 1e18) AS valueFROM erc20_ethereum.evt_TransferWHEREcontract_address = 0x78a0A62Fba6Fb21A83FE8a3433d44C73a4017A6fand "from" not in (0x28901cf869d94c9d892fbd86c8e57b801e8fdd87)and to not in (0x28901cf869d94c9d892fbd86c8e57b801e8fdd87)and DATE_TRUNC('day', evt_block_time) > date '2023-03-01'GROUP BY to , DATE_TRUNC('day', evt_block_time)union allSELECT"from" AS address,DATE_TRUNC('day', evt_block_time) AS day,-1 * SUM(value / 1e18) AS valueFROM erc20_ethereum.evt_TransferWHEREcontract_address = 0x78a0A62Fba6Fb21A83FE8a3433d44C73a4017A6fand "from" not in (0x28901cf869d94c9d892fbd86c8e57b801e8fdd87)and to not in (0x28901cf869d94c9d892fbd86c8e57b801e8fdd87)and DATE_TRUNC('day', evt_block_time) > date '2023-03-01'GROUP BY "from" , DATE_TRUNC('day', evt_block_time))group by 1,2)select day,address_type,sum(cumulative_balance) as cumulative_balance,COUNT(DISTINCT address) AS num_usersfrom(select a.day,b.address,sum(b.cumulative_balance) as cumulative_balance,CASEWHEN SUM(cumulative_balance) < 10000THEN '0~10000'WHEN SUM(cumulative_balance) < 100000THEN '10000~100000'WHEN SUM(cumulative_balance) < 500000THEN '100000~500000'WHEN SUM(cumulative_balance) < 1000000