Calculated UDF Field

I am trying to create a udf field in Project Entry that returns a calculated value. I have a BAQ with the calculated field and it is summing all sales orders related to the project and returns the sum. The purpose of the UDF field is so our PM’s can see when the total sales orders do not match the contract amount.

Is it possible to return a calculated value in a UDF field by project?

Thanks,
John