I don't think that is possible.
If you create a calculated attribute for the project object of type number and have selected your function the list of the attributes to be used for the argument only display the project attributes.
The area where your question is has been discussed before. To be able to use a query to get the value of an attribute would
be the solution. I think there is an idea for that in indeation.
In the mean time Dave Morton's How to put any dynamically generated value (for the properties views) is the closest thing.