I have the following data in my data model.

A resource works for 40 hours in a week. My requirement is that when user selects n number of projects, then the corresponding projectedhours should be substracted from 40.
Ex: If user selects 2 ptA projects and 3 ptB projects then (2x2.5hrs)+(3*4hrs) should be subtracted from 40 and I should get 40-12=27.
If user selects 1ptA project and 2 ptC projects then (1x2.5hrs)+(2x3hrs) should be subtracted from 40 and I should get 40-8.5=41.5.
I hope I have made the requirement clear. I'm not able to use the projectedhours in the expression.
Thanks,
Yash