Depends on your domain model.
But my guess is you have an order and orderline entity.
Retrieve all orderlines of the order from database and aggregate it with SUM function on orderlinevalue. This will lead to a SUM SELECT of orderlin values and return the SUM
//Edit//
In the Rapid developer course this and following lectures guides you on the calculation of the NrOfRegistrations https://academy.mendix.com/link/modules/94/lectures/738/7.8-Automatically-Calculating-the-Total-Number-of-Registrations
This logic is equal to an Order – Orderline situation, where instead of the Count aggregation the SUM aggregation should be used.
Option 1 the OQL-way
The best way, in terms of steps and in terms of performance is using OQL for this. To do this:
FROM YourModule.Order as o
JOIN o/YourModule.Orderline_Order/YourModule.Orderline as ol
GROUP BY o.Ordernumber
SELECT o.OrderNumber, SUM(ol.TotalPrice)
See https://service.mendixcloud.com/p/OQL for a OQL playground including lots of useful examples.
Option 2 The Mendix way:
The best way in terms of readability for mendix-developers and easy-to-program is to do it in your microflow in two steps:
My advice is the first option. Ran a test