Hi: Can any one please tell me how to i calculate the NGRate in percentage?
Thanks.


"(Case NGPmts+Gross When 0 Then 0 Else NGPmts*-1/(case when (NGPmts+Gross)*-1 = 0 then 1 " & _
"else (NGPmts+Gross) end ) *-1 End) As NGRate, " & _

QUERY
-----
sSql = "Select DU.User_ID As Collector, Count(*) As TotalPmts, Sum(Princ_Amt+Show_Int_Amt+Show_Fee_Amt) As Gross," & _
"Sum((Princ_Amt+Show_Int_Amt+Show_Fee_Amt)-(Clt_Princ_Amt+Clt_Int_Amt+Clt_Fee_Amt)) As Fee, " & _
"Sum(Case Pmt_Code When 'BCK' Then 1.0 When 'DBK' Then 1.0 When 'NGC' Then 1.0 Else 0 End) As NGChecks," & _
"Sum(Case Pmt_Code When 'BCK' Then (Princ_Amt+Show_Int_Amt+Show_Fee_Amt) " & _
"When 'DBK' Then (Princ_Amt+Show_Int_Amt+Show_Fee_Amt)" & _
"When 'NGC' Then (Princ_Amt+Show_Int_Amt+Show_Fee_Amt) Else 0 End) As NGPmts, " & _
"(Case NGPmts+Gross When 0 Then 0 Else NGPmts*-1/(case when (NGPmts+Gross)*-1 = 0 then 1 " & _
"else (NGPmts+Gross) end ) *-1 End) As NGRate, " & _
"Goal, (Case Goal When 0 Then 0 Else Fee/Goal End) As GoalPct, Team, Off_Loc From Pmt P " & _
"Join PmtUser U On U.Pmt_ID=P.Pmt_ID Join DMUser DU On DU.User_ID=U.User_ID " & _
"Where Pmt_Date Between " & sDMStartDate & " And " & sDMEndDate & " Group By DU.User_ID, Goal, Team, Off_Loc " & _
"Order By Off_Loc, Team, DU.User_ID"