Answer:
with producttotals as
(select p.category,
p.name as productname,
sum(od.quantity) as totalquantity
from orderdetails od
join products p on od.productid = p.productid
group by p.category,
p.name)
select category,
productname,
totalquantity,
cume_dist() over (partition by category
order by totalquantity desc) as quantitydistribution
from producttotals;