Previous month in parameter

date, parameters, reporting-services

Solution

If i understand you right you want to:

Get the first day of two months from now

=DateAdd("m", -2, DateSerial(Year(Now()), Month(Now()), 1))

And you want to get the last day on month two months from now

=DateAdd("d" , -1 , DateAdd("m", -1, DateSerial(Year(Now()), Month(Now()), 1)))

Problem

I need to set a Hidden Default Parameter in SSRS. In my query I need to not show last months total but the month before that, ie in Feb I need to show Dec totals. I usually use this for last month but cannot tweak it for the month prior. Set first date of last month: ``` =DateAdd("m", -1, DateSerial(Year(Now()), Month(Now()), 1)) ``` Set last date of last month: ``` =DateAdd("d", -1, DateSerial(Year(Now()), Month(Now()), 1)) ```

Original source