This assumes that you have group #1 = product, and group #2 on salesrep. Your first example is probably just:
sum({table.amt},{table.product})
For the second example, you would use variables:
//{@reset} to be placed in the group header for product:
whileprintingrecords;
numbervar sumgoals := 0;
//{@accum} to be placed in the group header or footer for salesrep:
whileprintingrecords;
numbervar sumgoals := sumgoals + maximum({table.goals},{table.salesrep});
//{@display} to be placed in the product group footer:
whileprintingrecords;
numbervar sumgoals;
-LB