Query editor
SELECT block_date,total_monthly_revenue,(total_monthly_revenue - revenue_last_month) / revenue_last_month as revenue_performance_perc,((total_monthly_revenue - revenue_last_month) / revenue_last_month) * 100 as revenue_performance_perc_counter,"Protocol",("Protocol" - "protocol_last_month") / protocol_last_month as protocol_performance_perc,"Liquidity Pools",("Liquidity Pools" - "lpools_last_month") / lpools_last_month as lpools_performance_perc,"Opensea",("Opensea" - "opensea_last_month") / opensea_last_month as opensea_performance_perc,"Unknown",("Unknown" - "unknown_last_month") / unknown_last_month as unknown_performance_perc,SUM(total_monthly_revenue) OVER () as all_time_revenue_usdFROM (SELECT block_date,total_monthly_revenue,LEAD(total_monthly_revenue,1) OVER (ORDER BY block_date DESC) as revenue_last_month,"Opensea",LEAD("Opensea",1) OVER (ORDER BY block_date DESC) as opensea_last_month,"Liquidity Pools",LEAD("Liquidity Pools",1) OVER (ORDER BY block_date DESC) as lpools_last_month,"Protocol",LEAD("Protocol",1) OVER (ORDER BY block_date DESC) as protocol_last_month,"Unknown",LEAD("Unknown",1) OVER (ORDER BY block_date DESC) as unknown_last_monthFROM (SELECT block_date,COALESCE(MAX(CASE WHEN category = 'Opensea' THEN category_monthly_revenue ELSE null END),0) as "Opensea",COALESCE(MAX(CASE WHEN category = 'Liquidity Pools' THEN category_monthly_revenue ELSE null END),0) as "Liquidity Pools",COALESCE(MAX(CASE WHEN category = 'Protocol' THEN category_monthly_revenue ELSE null END),0) as "Protocol",COALESCE(MAX(CASE WHEN category = 'Unknown' THEN category_monthly_revenue ELSE null END),0) as "Unknown",COALESCE(MAX(total_monthly_revenue),0) as total_monthly_revenueFROM (SELECT block_date,category,SUM(amount_usd) as category_monthly_revenue,SUM(SUM(amount_usd)) OVER (ORDER BY block_date) as total_monthly_revenueFROM query_2285179GROUP BY 1,2) xGROUP BY 1ORDER BY 1 DESC) p) q