I worked with this report recently and saved some notes. I dont remember if this was from a techdoc or in the query itself, but:
If the record is a summary task (prIsTask = 0), use the summary task's dates in the denominator.
If the record is a detail task (prIsTask = 1) and it's at the top level (prWBSLevel = 1), use the project's dates in the denominator.
If the record is a detail task (prIsTask = 1) and it's not at the top level (prWBSLevel > 1), use the summary task's dates in the denominator.
Schedule % (stoplight) and Days Late % (value):
If there is a Baseline and Finish Date is not equal to Baseline Finish Date, then ((Finish Date – Baseline Finish Date) /
(Baseline Finish Date – Baseline Start Date)) * 100 (This calculates days late % positive or negative based on baseline).
If there is a Baseline and Finish Date equals Baseline Finish Date and Project Progress (or Task Status) is not completed
and the Finish Date is before Today’s Date, then ((Today’s Date – Finish Date)/(Baseline Finish Date – Baseline Start Date)) * 100
(This calculates days late % positive if the project/task isn’t late according to the baseline, but it isn’t completed and it is
has a finish date before today’s date).
If there is no Baseline and Project Progress (or Task Status) is not completed and the Finish Date is before Today’s Date,
then ((Today’s Date – Finish Date)/(Finish Date – Start Date)) * 100 (This calculates days late % positive if there is not any
baseline and the project/task isn’t completed and it is has a finish date before today’s date).