1 of 1 people found this helpful
What are you trying to do there?
It's Friday. I couldn't follow your syntax.
I think you might be helped with the MAKEDATE function.
And if you want to find the last day of any month, make a date that is the first day of [Report Month]+1, and then subtract one day. The "day" portion of the result is the last day of the current month.
Highest day of the current month is, of course, DATEPART('day'. TODAY())
Somehow in your logic above, your current month logic is adding two month's worth of days. (26 for this month and 30 for next month, I would guess.) If you use MAKEDATE instead of DATEADD, you just build exactly what you need.
I think it's because you're adding a month to the current month (August) - so instead of having the 26 days to date in August you have 26 days + 30 days where you've added a month.
I expect if you don't add a month when it's the current month and year you'll come out with the answer you want.
That's an educated guess based on the formula, however it's not easy to follow, a packaged workbook would help test.
"I think you might be helped with the MAKEDATE function."