I created two subqueries. One totals the sales booked by order date and the other totals the invoices billed by doc date. When I add the two subqueries to the main query and try to filter on a date range I get the object reference error.
Booked Query

Invoiced Query

Both are grouping by date, the formula is makes the amount negative if a CM.
Conditions

Main left joins invoiced query to booked query by date.
Without the conditions the data is returned

