I think you might be able to do this with a window function query. You can see an example with the system BAQ named: zGSTR1-B2B_InvcDtl_IN . If you change the ICE.QueryHdr.CGCode to an empty string you can load the BAQ in the designer and see how Epicor created it. What you want is to sum it over the group something like:
SELECT CustNum, OrderNum, PartNum,
SUM(UnitPrice*OrderQty) OVER(PARTITION BY PartNum) AS SubTotal
FROM ERP.OrderDtl;
There is a ton of information on window functions here: https://windowfunctions.com/ also on Pluralsight or even Youtube Window functions in SQL Server - YouTube