I think your syntax is wrong. iif should be IIF(<expresstion to evaluate>,<then expression>,<else expression>) and safedivide takes
safedivide(<numerator>,<denominator>,<if denom 0 return expression>). So you have
SafeDivide(IIF
(Year([HEADER_RR.ORIGONPLANDT])>= "2005",[LIBLEADERDETAIL_RR.HOMECNT]/DateDiff("d",HEADER_RR.ORIGONPLANDT],EndDate)*7,[LIBLEADERDETAIL_RR.HOMECNT]/YTDWEEKSVAR,0)
)
and you probably want
In other words (pseudo code here):
if Year([HEADER_RR.ORIGONPLANDT])>= "2005") then
if DateDiff("d",[HEADER_RR.ORIGONPLANDT],EndDate)* 7 <> 0 then
([LIBLEADETAIL_RR.HOMECNT]/
DateDiff("d",[HEADER_RR.ORIGONPLANDT],EndDate)*7
else
<your divide default>)
end if
else
if YTDWEEKSVAR<>0 then([LIBLEADERDETAIL_RR.HOMECNT]/YTDWEEKSVAR
else
0
end if
end if
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.