Skip to main content

Hello,

Working on a GI to replicate some Excel reporting we are doing outside the system. 

I am receiving an error on the Formula for “Margin in Backlog (%)” , the error is Divide by zero error encountered. Can anyone notice anything wrong with the below formula or another way to avoid the divide by zero error?

 

Thanks,

KT

 

Margin in Backlog (%) Formula

=100*((sum(IIf( uPMBudget.Type]=tRev] And ePMBudget.CuryRevisedAmount] <> 0, &PMBudget.CuryRevisedAmount], Null))-sum(IIf( uPMBudget.Type]=tRev] And ePMBudget.CuryActualAmount] <> 0, &PMBudget.CuryActualAmount], Null))-(sum(IIf( uPMBudget.Type]=tCost] And sPMBudget.CuryRevisedAmount] <> 0, &PMBudget.CuryRevisedAmount], Null))-sum(IIf( uPMBudget.Type]=tCost] And sPMBudget.CuryActualAmount] <> 0, &PMBudget.CuryActualAmount], Null))))/(sum(IIf( uPMBudget.Type]=tRev] And ePMBudget.CuryRevisedAmount] <> 0, &PMBudget.CuryRevisedAmount], Null))-sum(IIf( uPMBudget.Type]=tRev] And ePMBudget.CuryActualAmount] <> 0, &PMBudget.CuryActualAmount], Null))))

@ketiller,

I think the issue is when the result of functions following the “/” will result in 0 if the Actual and Budget amounts are both the same therefore resulting in the divide by zero error.  An option would be to add an initial comparison to see if the values are the same:

Consider:

 IIf (>PMBudget.CuryRevisedAmount] = nPMBudget.CuryActualAmount] , 0,

100*(

(sum(IIf( (PMBudget.Type]=TRev], RPMBudget.CuryRevisedAmount], Null))

-sum(IIf(mPMBudget.Type]=TRev] , ePMBudget.CuryActualAmount], Null))

-(sum(IIf( (PMBudget.Type]=TCost], oPMBudget.CuryRevisedAmount], Null))

-sum(IIf( (PMBudget.Type]=TCost], oPMBudget.CuryActualAmount], Null))

))

/(sum(IIf( (PMBudget.Type]=TRev], RPMBudget.CuryRevisedAmount], Null))

-sum(IIf( (PMBudget.Type]=TRev], RPMBudget.CuryActualAmount], Null))

)))

 

Just a quick thought on looking through your formula - would need to be tested in the GI.

I hope this helps!! Michelle


@ketiller 

Sorry - the grouping requires the sum for values on the first line:

Consider:

 IIf (sum(>PMBudget.CuryRevisedAmount]) = sum(>PMBudget.CuryActualAmount]) , 0,

100*(

(sum(IIf( (PMBudget.Type]=]Rev], ,PMBudget.CuryRevisedAmount], Null))

-sum(IIf(fPMBudget.Type]=]Rev] , ,PMBudget.CuryActualAmount], Null))

-(sum(IIf( (PMBudget.Type]=]Cost], ,PMBudget.CuryRevisedAmount], Null))

-sum(IIf( (PMBudget.Type]=]Cost], ,PMBudget.CuryActualAmount], Null))

))

/(sum(IIf( (PMBudget.Type]=]Rev], ,PMBudget.CuryRevisedAmount], Null))

-sum(IIf( (PMBudget.Type]=]Rev], ,PMBudget.CuryActualAmount], Null))

)))

 

Let me know if you have any other issues.

 

Thanks,

Michelle


Hi @michellehesketh58 

 

Thanks for the idea, I tried out the formula and got this error:

 

Thank you,

KT


Hi @michellehesketh58

 

Thanks for the feedback, we updated the formulas and had to add in the type since we are looking at revenue and cost. 

=IIf (sum(uPMBudget.Type]=eRev] And nPMBudget.CuryRevisedAmount]) = sum(uPMBudget.Type]=eRev] And nPMBudget.CuryActualAmount]) , Null ,100*((sum(IIf( fPMBudget.Type]=eRev] And nPMBudget.CuryRevisedAmount] <> 0, 0PMBudget.CuryRevisedAmount], Null))-sum(IIf( fPMBudget.Type]=eRev] And nPMBudget.CuryActualAmount] <> 0, 0PMBudget.CuryActualAmount], Null))-(sum(IIf( fPMBudget.Type]=eCost] And nPMBudget.CuryRevisedAmount] <> 0, 0PMBudget.CuryRevisedAmount], Null))-sum(IIf( fPMBudget.Type]=eCost] And nPMBudget.CuryActualAmount] <> 0, 0PMBudget.CuryActualAmount], Null))))/(sum(IIf( fPMBudget.Type]=eRev] And nPMBudget.CuryRevisedAmount] <> 0, 0PMBudget.CuryRevisedAmount], Null))-sum(IIf( fPMBudget.Type]=eRev] And nPMBudget.CuryActualAmount] <> 0, 0PMBudget.CuryActualAmount], Null)))))

 

From that, we received a new error message 

 

Thank you,

KT


Hi @ketiller were you able to find a solution? Thank you!


Reply