Query editor
WITH getDailyTVL as (SELECT * FROM (SELECT date,pool_name,gev_usd,(gev_usd - LAG(gev_usd, 7) OVER (PARTITION BY pool_name ORDER BY date)) / LAG(gev_usd, 7) OVER (PARTITION BY pool_name ORDER BY date) * 100 AS growth_7_days_percentage,(gev_usd - LAG(gev_usd, 14) OVER (PARTITION BY pool_name ORDER BY date)) / LAG(gev_usd, 14) OVER (PARTITION BY pool_name ORDER BY date) * 100 AS growth_14_days_percentage,(gev_usd - LAG(gev_usd, 21) OVER (PARTITION BY pool_name ORDER BY date)) / LAG(gev_usd, 21) OVER (PARTITION BY pool_name ORDER BY date) * 100 AS growth_30_days_percentageFROM query_3338374)WHERE date = CURRENT_DATE)SELECT date,pool_name,gev_usd,vault_cap,gev_usd / vault_cap as vault_capacity,CASE WHEN growth_7_days_percentage > 0 THEN '⬆️ +' || format('%.2f',growth_7_days_percentage) || '%' ELSE '🔻 ' || format('%.2f',growth_7_days_percentage) || '%' END as growth_7_days_percentage,CASE WHEN growth_14_days_percentage > 0 THEN '⬆️ +' || format('%.2f',growth_14_days_percentage) || '%' ELSE '🔻 ' || format('%.2f',growth_14_days_percentage) || '%' END as growth_14_days_percentage,CASE WHEN growth_30_days_percentage > 0 THEN '⬆️ +' || format('%.2f',growth_30_days_percentage) || '%' ELSE '🔻 ' || format('%.2f',growth_30_days_percentage) || '%' END as growth_30_days_percentage,SPLIT_PART(CAST(human_readable_seconds(to_unixtime(current_timestamp) - to_unixtime(last_updated)) AS VARCHAR),',',1)|| SPLIT_PART(CAST(human_readable_seconds(to_unixtime(current_timestamp) - to_unixtime(last_updated)) AS VARCHAR),',',2) || ' ago'FROM getDailyTVL LEFT JOIN query_3341056 USING (date,pool_name)ORDER BY 3 DESC