Originally Posted by
GratefulSteve
Hi Jeff,
Thank you for your patience. :-)
The latter. That's why I was trying to use the IIf. My intention was to display zero in any future month until the first of the month. Then, when the first entry under Actual was entered, the graph would pick right up with the previous months total plus the new Actual entry.
Thanks again,
Steve
Try this--
Code:
SELECT Format([DateTime], "mmm") AS MonthName ,iif(sum([NPActual])>0,DSum("NPGoal", "Calendar", "DatePart('m', [DateTime])<=" & [Month] & " And DatePart('yyyy', [DateTime])=" & [YearName] & ""),0) AS Goal
,iif(sum([NPActual])>0,DSum("NPActual", "Calendar", "DatePart('m', [DateTime])<=" & [Month] & " And DatePart('yyyy', [DateTime])=" & [YearName] & ""),0) AS Actual
,Month([DateTime]) AS [Month]
,Format([DateTime], "yyyy") AS YearName
FROM Calendar
GROUP BY Format([DateTime], "mmm")
,Month([DateTime])
,Format([DateTime], "yyyy")
HAVING (((Format([DateTime], "yyyy")) = "2016"))
ORDER BY Month([DateTime]);