Query editor
with timedelta as (select casewhen lower('{{Time Granularity}}') = 'day' then (now() - interval '1' day)when lower('{{Time Granularity}}') = 'week' then (now() - interval '7' day)when lower('{{Time Granularity}}') = 'month' then (now() - interval '30' day)end as time),tab as (select a.blockchain, 100 * uni_volume / dex_volume as uni_marketsharefrom (select blockchain, sum(amount_usd) as uni_volumefrom dex.tradeswhere project = 'uniswap'and (not {{Show V3 Only}} or version = '3')and block_time >= (select time from timedelta)and token_bought_address not in (0xc5b3d3231001a776123194cf1290068e8b0c783b, 0xfb5453340c03db5ade474b27e68b6a9c6b2823eb, 0xe7f58a92476056627f9fdb92286778abd83b285f)and token_sold_address not in (0xc5b3d3231001a776123194cf1290068e8b0c783b, 0xfb5453340c03db5ade474b27e68b6a9c6b2823eb, 0xe7f58a92476056627f9fdb92286778abd83b285f)group by 1) aleft join (select blockchain, sum(amount_usd) as dex_volumefrom dex.tradeswhere block_time >= (select time from timedelta)and token_bought_address not in (0xc5b3d3231001a776123194cf1290068e8b0c783b, 0xfb5453340c03db5ade474b27e68b6a9c6b2823eb, 0xe7f58a92476056627f9fdb92286778abd83b285f)and token_sold_address not in (0xc5b3d3231001a776123194cf1290068e8b0c783b, 0xfb5453340c03db5ade474b27e68b6a9c6b2823eb, 0xe7f58a92476056627f9fdb92286778abd83b285f)group by 1) bon a.blockchain = b.blockchain)select * from taborder by blockchain