select date_trunc (day,date) as date,
case when date < '2024-12-16 17:00:00.000' then 'Before Upgrade'
else 'After Upgrade' end as timespan,
sum (fees) as fees,
sum (revenue) as Revenue
from external.defillama.fact_protocol_fees_revenue
where date >= '2024-11-10'
and chain ilike '%avalanche%'
and protocol ilike '%joe%'
group by 1,2
order by 1 desc