Answer:
with customertotals as
(select c.species,
o.customerid,
sum(o.totalamount) as totalspending
from orders o
join customers c on o.customerid = c.customerid
group by c.species,
o.customerid)
select species,
customerid,
totalspending,
ntile(4) over (partition by species
order by totalspending desc) as spendingtier
from customertotals;