Forum Discussion
BillyBussey
7 years agoQrew Trainee
The code I posted above worked. Just the subtraction part needed to be in its own set of parentheses.
AlexCertificati
7 years agoQrew Cadet
The parens around the subtraction value aren't relevant, it's that you needed to do the subtraction outside the arguments for Sum().
In other words your final code
Sum ([SoftScape Total],[HardScape Total],[Aggregate Total],[Removal Total])-([Discount])
works, and this would also work
Sum ([SoftScape Total],[HardScape Total],[Aggregate Total],[Removal Total])-[Discount]
I don't know offhand if
Sum ([SoftScape Total],[HardScape Total],[Aggregate Total],[Removal Total],-[Discount])
would work, but I suspect not
Addendum - if for some reason you HAD to do it that way (no idea why you might, just go with it), you'd either put negative values in [Discount] or else create a field (called [Discount to Apply] or something) with a formula [Discount]*(-1) and use that in your sum formula:
Sum ([SoftScape Total],[HardScape Total],[Aggregate Total],[Removal Total],[Discount to Apply])
In other words your final code
Sum ([SoftScape Total],[HardScape Total],[Aggregate Total],[Removal Total])-([Discount])
works, and this would also work
Sum ([SoftScape Total],[HardScape Total],[Aggregate Total],[Removal Total])-[Discount]
I don't know offhand if
Sum ([SoftScape Total],[HardScape Total],[Aggregate Total],[Removal Total],-[Discount])
would work, but I suspect not
Addendum - if for some reason you HAD to do it that way (no idea why you might, just go with it), you'd either put negative values in [Discount] or else create a field (called [Discount to Apply] or something) with a formula [Discount]*(-1) and use that in your sum formula:
Sum ([SoftScape Total],[HardScape Total],[Aggregate Total],[Removal Total],[Discount to Apply])