подскажите, плиз
есть таблица фактов (ид покупателя, ид транзакции, ид категории и т.д)
нужно посчитать для каждого клиента топ 10 категорий, и их долю в общем.кол.покупок
топ 10 я считал через сте
with topten
as
(
select b1.Mobile,
s.PCatID
ROW_NUMBER() over
(
PARTITION BY b1.Mobile
order by b1.Mobile, count (distinct t.TransactionId) desc
) as RowNo
from Buyers b1
inner join _DCards d on d.BuyerID=b1.BuyerID
inner join Transactions t on t.CardID=d.CardID
inner join TransactionItems tr on tr.TransactionId=t.TransactionId
inner join _SKU s on s.SKU=tr.SKU
where t.DocDate between '20190601' and '20200531' and t.TransactionTypeID in (2,3) and tr.SKU<>424204
group by b1.Mobile, s.PCatID )
а как теперь посчитать долю их?