For anyone if they stuck at length() function not working to get the progress show, I stuck the same question like you, and use the group by syntax to get the similar result, hope it can helps you.
table length(rows) as total, sum(rows.completed) as completed, sum(rows.completed) / length(rows) * 100 + "%" as Progress, rows[0].file.link as Next
from #tasks
sort file.mtime asc
group by project
if anyone know the answer why my length() is not working (seems like I am not only one meet this problem), please let me know.