Top 5 Products sold

@Matthew_Lawless, yes it works for E10 with a few tweaks in SQL SSMS. I was also thinking of how to do a count on the Customer and then use that to filter the “top 5” so thanks for posing the SQL Query. Just be sure to change ‘YourCompany’ to the real value.

With TopSellers AS
(SELECT	
 c.name
 ,id.partnum
 ,SUM(id.DocExtPrice) as [SalesAmt]
,ROW_NUMBER() OVER (PARTITION BY c.Name ORDER BY sum(id.DocExtPrice) DESC) AS RowNum

FROM erp.InvcHead as i	
inner join customer as c  on i.CustNum = c.Custnum and i.company = c.company
Inner join erp.InvcDtl as id on i.invoicenum = id.invoicenum and i.company = id.company
Inner join Part as p on id.partnum = p.partnum and id.company = p.company

where i.InvoiceDate BETWEEN DATEADD(day, -365, GETDATE()) AND GETDATE() AND i.company = 'YourCompany'

GROUP BY c.Name, id.PartNum
)
SELECT * FROM TopSellers Where RowNum <= 5