For some reason the completion rate is return 0. I have two tables: projects and project_tasks. I’m getting back the correct # of tasks by status, but when I do [_THISROW].[Completed Tasks]/[_THISROW].[Total Tasks] it returns 0.
Here are the raw #'s
Here are my field definitions
Total Task
Total Tasks = COUNT(FILTER(“project_tasks”, [project_id] = [_THISROW].[id]))
Open Tasks = COUNT(FILTER(“project_tasks”, AND([Status] <> “Done”, [project_id] = [_THISROW].[id])))
Completed Tasks = COUNT(FILTER(“project_tasks”, AND([Status] = “Done”, [project_id] = [_THISROW].[id])))
Completion Rate = [_THISROW].[Completed Tasks]/[_THISROW].[Total Tasks]
When I test the expressions, the Total Tasks, Open Tasks and Completed Tasks are correct
I switched the type between decimal and percentage. Still nothing.
What am I missing??
Because the Task columns are defined as NUMBER, the resulting expression is attempting to return a like NUMBER value as well. The decimal result is less than 0.5 so the NUMBER result rounds DOWN to zero.
Try this expression instead:
([_THISROW].[Completed Tasks] * 1.0) / ([_THISROW].[Total Tasks] * 1.0)
You probably don’t need to multiply both operands. I do … just because!
3 Likes
@Suvrutt_Gurjar @WillowMobileSys
Related to this, I’m seeing some weirdness happen.
Here is the video to help illustrate what’s going on: https://drive.google.com/file/d/1g8-ctYhPgVe7shzLB1qwoPknBUX4BF9U/view?usp=drive_link
So I’m calculating the % complete, sometimes it works and sometimes it defaults to BLANK.
I’m not sure why this is occurring. Even in the individual virtual column where I’m calculating the percentage rates, sometimes it shows the correct decimal and then sometimes it set is to 0?
Any thoughts?