Skip to main content
Planview Customer Success Center

DS_ResourceDemand view returns 'Divide by zero error’

Symptoms:


DS_ResourceDemand and DS_RD_TaskAssignment fails to execute.

Error/warning messages:
Divide by zero error encountered


Reason:


Some task assignments have “0” working days. Execute the statement below to find out such task assignment records:

SELECT t.WorkingDays , t.CustomerName, t.ItemName, t.SubItemName, wm.ResourceName, wd.WorkingDate 'ResDemandDate', t.*
FROM DS_RD_Resource wm
INNER JOIN DS_RD_TaskInfo t ON wm.ResourceId=t.ResourceId
INNER JOIN WorkingDays wd WITH (NOLOCK) ON wd.WorkingDate>=CONVERT(DATETIME, CONVERT(VARCHAR(10), GETDATE(), 101), 101)
and DATEDIFF(dd, t.PlannedStart, wd.WorkingDate)>=0 AND DATEDIFF(dd,WorkingDate, t.PlannedFinish )>=0
AND NOT EXISTS (SELECT TOP 1 1 FROM ResourceNonWorkingDays wn WITH (NOLOCK) WHERE wn.ResourceId=ISNULL(wm.ResourceId,'00000000-0000-0000-0000-000000000000') AND wd.WorkingDate=wn.NonWorkingDate) and t.WorkingDays = 0


Resolution:


The “divide by zero” error can be corrected by applying the steps below:
1- Edit the task, find and select the assignment; wait until the selected assignment information is populated
2- Select “Apply” in the actions menu of the assignments section
3- Select “Save” in the actions menu of the task page

This will correct the assignment data by saving non-zero working days as expected