Sum over with condition

I am trying to sum values with a condition over purchase order number (PO).

ifelse({procurement_portal_fc}={fc_received}, sumOver({quantity_unpacked}, [{purchase_order_number}]), NULL)

But I’m getting the following error:
Mismatched aggregation. Custom aggregations can’t contain both aggregated and nonagreggated fields, in any combination.

Since that is not a valid expression, how can I calculate a sum over with condition?

Hello Crizar,

What is the significance of repeating the purchase order without other column as an out put ?

Nevertheless, could you try some thing like this if it helps ?
sumOver(ifelse({Procurement_portal_fc}={fc_receieved},{quantinti-unpacked},0),[{Purchase_order}],PRE_AGG)

Thank you.
Cheers,
Deep

This is exactly what I was looking for. Thank you so much.

The reason for repeating the purchase order in the output is just because I need all the columns with other values as well, but in the case of only showing those two columns I wouldn’t need to replicate it.