Query editor
with prep as (selectdate_parse(payout_date, '%d/%m/%Y') as payout_date,replace(replace(replace(other_parties_aliases_contacts, 'Solver', ''), 'Rewards', ''), ' - ', '') as solver,sum(outgoing_volume) as total_rewards_cow,sum(quote_rewards) as quote_rewards_cow,sum(performance_rewards) as performance_rewards_cow,sum(outgoing_volume*p.price) as total_rewards_usd,sum(quote_rewards*p.price) as quote_rewards_usd,sum(performance_rewards*p.price) as performance_rewards_usdfrom dune.cowprotocol.dataset_solver_rewards_allocation_to_network as rleft join prices.day as pon date_parse(r.payout_date,'%d/%m/%Y')=p.timestampand p.blockchain='ethereum'and p.contract_address=0xdef1ca1fb7fbcdc777520aa7f396b4e015f497abwhere network in (select chain from unnest(split('{{network}}', ',')) as t(chain))and date_parse(payout_date, '%d/%m/%Y') >= timestamp '{{start_date}}'group by 1,2),time_periods as (selectpayout_date,solver,total_rewards_cow,quote_rewards_cow,performance_rewards_cow,total_rewards_usd,quote_rewards_usd,performance_rewards_usd,casewhen payout_date >= current_date - interval '6' month then 'Last 6 Months'else nullend as last_6_months,casewhen year(payout_date) = year(current_date) then 'YTD'else nullend as ytd,casewhen year(payout_date) = 2025 then '2025'else nullend as year_2025,casewhen year(payout_date) = 2024 then '2024'else nullend as year_2024from prepwhere solver = 'Rizzolver'),aggregates as (select'Last 6 Months' as period,count(distinct payout_date) / 4.0 as weeks,sum(case when last_6_months is not null then total_rewards_{{unit}} else 0 end) as total_rewards,sum(case when last_6_months is not null then quote_rewards_{{unit}} else 0 end) as quote_rewards,sum(case when last_6_months is not null then performance_rewards_{{unit}} else 0 end) as performance_rewardsfrom time_periods