I'd like to run stats retrieving only Last Month's data using broadcast agent and run it on the first of the month. What I've come up with below works until January. In January 2006, it's going to look for December 2006. Is there some way to query for only last month's data? I'm struggling with the limited number date functions available.
= MonthNumberOfYear(<mydate>) = MonthNumberOfYear(CurrentDate()) -1 And Year(<mydate>)=Year(CurrentDate())
= MonthNumberOfYear(<mydate>) = MonthNumberOfYear(CurrentDate()) -1 And Year(<mydate>)=Year(CurrentDate())