First and Last day of current month

Jonathan Holston picture Jonathan Holston · Oct 21, 2011 · Viewed 71.4k times · Source

In SQL Server Reporting Services; How can I calculate the first and last day of the previous month?

I know I can use the expression below to get the last day of the current month, but I'm stuck when trying to find the first and last of the previous month.

=DateSerial(Year(Now()), Month(Now()), "1").AddMonths(1).AddDays(-1)

Answer

Austin Salonen picture Austin Salonen · Oct 21, 2011

Just a guess based on your code working.

--previous month last
=DateSerial(Year(Now()), Month(Now()), "1").AddDays(-1)

--previous month first
=DateSerial(Year(Now()), Month(Now()), "1").AddMonths(-1)