Percent Calculation not calculating, returning 0

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
DayToDataInc_1-1726496223761.png

Here are my field definitions
Total Task
DayToDataInc_0-1726496157629.png
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

DayToDataInc_2-1726496802159.png

I switched the type between decimal and percentage. Still nothing.

What am I missing??

 

Solved Solved
0 5 222
1 ACCEPTED SOLUTION

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!

View solution in original post

5 REPLIES 5