Hi,
You can achieve this using rules. For the first rule, add the condition as if field1, field2, field3 is blank then the action is to be set Grand total to the subtotal value. And the second rule is if field1, field2, field3 is not blank then the action is to be set Grand total to add field1, field2, field3 and subtotal.