We need to use a PU function where we want to pull up to a key stored in the same table as where we want to do the SUM over (in our case):
PU_SUM(DOMAIN_TABLE('table1'.'key1'),'table1'.'field1')
However, key1 occurs multiple times in the table, resulting in the sum of field1 being repeated for each occurrence. How can we only get a result once per key? We tried adding DISTINCT but that didn't work...