See the help on the Sum() function. Put something like the following into the group header formula to set the category column:
local numbervar po_total := Sum({table.invoice_amount}, {table.po_number});
if po_total < 5000 then "xxx" else "yyy"