The issue is probably because of your use of the sumIf calculation. If you just return the value in an ifelse statement, it should still function the way you want and be useable in a table calculation. Try something like this:
SumIf will return a ‘custom aggregation’ therefore, QS will not allow a different aggregation to be completed. But if you utilize something like the above, it allows table aggregations to be added.