Du kan använda case
uttryck, både runt beräkningen och inom fönstret sum
:
select
sales_date,
country,
sum(sales_volume),
case when country <> 'NL'
then sum(sum(fix_costs)) over(partition by year(sales_date), month(sales_date))
/ day(last_day(sales_date))
* sum(sales_volume)
/ sum(case when country <> 'NL' then sum(sales_volume) else 0 end) over(partition by sales_date)
else 0
end as fix_cost_per_day
from sales
group by 1,2;