Query editor
WITH productive_tvl AS (SELECTchain_name,week,productive_tvl AS productive_tvl_usdFROM query_3937579),chain_tvl AS (SELECTchain_name,week,total_usd AS bridge_value_usdFROM query_3937566),combined_data AS (SELECTp.chain_name,p.week,c.bridge_value_usd,p.productive_tvl_usd,CASEWHEN c.bridge_value_usd > 0THEN (p.productive_tvl_usd / c.bridge_value_usd) * 100ELSE 0END AS productive_tvl_percentage,c.bridge_value_usd - p.productive_tvl_usd AS value_outside_productive_tvlFROM productive_tvl pJOIN chain_tvl c ON p.chain_name = c.chain_name AND p.week = c.week)SELECTweek,chain_name,bridge_value_usd,productive_tvl_usd,ROUND(productive_tvl_percentage, 2) AS productive_tvl_percentage,value_outside_productive_tvlFROMcombined_dataWHEREweek > DATE '2022-01-01'ORDER BYweek,chain_name