Yes, it's possible to calculate that, but it's a bit harder to do if you have a variable amount of tasks for each "weight".
So your overall project completion percentage will actually be the addition of three separate calculations.
IE you will need to calculate all of your "low" tasks as a total percentage of 15%, your medium as a total percentage of 30%, then the high as a percent total of 55%, ending with adding those three percentages together for the total project percentage.
So to calculate one of those three values, you would need a calculation out of 100% possible of a 15% "weight" for low values. So if you have 4 low tasks, 2 of which are complete, the calculation to get your desired 7.5% would be:
(15/100) / ( 2 / 4 ) or ( weight value / project total ) / (completed weight tasks / total weight tasks)
You could easily convert this to ExecuteSQL:
.15 / (
ExecuteSQL("SELECT COUNT(*) FROM Tasks WHERE ProjectID = ? AND Status = 'Complete' AND Priority='Low'" ; "" ; "" ; Projects::ProjectID) /
ExecuteSQL("SELECT COUNT(*) FROM Tasks WHERE ProjectID = ? AND Priority='Low'" ; "" ; "" ; Projects::ProjectID)
That's the basic premise. It's a bit rough, there might be an easier way to evaluate the calculations, but it will always be: Weight Percent Value / Weight Completion Percentage.
Yeah_ What Mike said.
Said in a different way: You will end up with four "Percent of Complete" results. One for each of the categories (Low, Med, High) and one for the overall project.
The calcs for categories will include a not to exceed value. Low 15%, Med 30%, High 55% . Obviously, you will need to account for not having any Low tasks, etc.
You can calculate the "results" in one complex calc field or parse them into separate events for the sake of sanity.
Having said that, and not knowing the subject matter of your endeavor, you might consider using a model resembling a mechanic's "Flat Rate" system. Where a mechanic is working in units of time you might create units that equal numeric points. Either way as you add tasks you create an estimate displayed as a aggregate number for the project.
It will be fun.
Excellent feedback! Thank you both for this information I willgive these suggestions a shot!