We can run the report below to find the percentage of tasks that we are completing before thir due date:
SELECT DPQL_ALIAS(DPQL_PERCENT(UNIX_TIMESTAMP(tasks.date_completed) < UNIX_TIMESTAMP(tasks.date_due)), 'Percentage of tasks completed in time')
WHERE tasks.is_completed = 1
GROUP BY tasks.person.name
Here we use the UNIX_TIMESTAMP* which allows us to apply a numerical value to a date-time.
The number simply counts up so the further into the future the higher the number.
In this instance we're simply finding whether tasks.date_completed is less than tasks.date_due.
We're then fomatting this using DPQL_PERCENT.
* You can read more about UNIX Timestamp below: