What do you want to do with the result? Do you want to store it in a different attribute? You could use a nanoflow or microflow to add the two values (depending on your use case, try calculated attribute or on change/save nano/microflow).
Or are you talking about the sum in a datagrid?
If you retrieved the objects and aggregated them (like Nico said, look at the optimization !!), you can then add these values together. See the example below using a variable, but you could use the same logic setting an attribute via a change object activity.
The sum functionality of the aggregate activity will sum the indicated values of the given list. Thus, you need to filter the list prior to aggregating it.
The same is true for data grid aggregation.
If you need to aggregate 2 different attributes on an object, you need to use the aggregate function twice and then add the aggregated values together.
Just note that Mendix has a build-in optimization where, if you retrieve a list from the database and then aggregate, only the aggregated value are pulled into memory and not the entire list – assuming you do not use the list again. So, depending on your use case, you may need to retrieve and aggregate twice.
In really extreme cases, you can look into OQL for alternative summing methods