0

I am looking to use an expression which will find the next month end date based on a month end date passed through by a parameter.

I am trying to convert the SQL statement I would use to do this into an SSRS expression. The SQl statement I would use is:

DATEADD("m", +1, @Mth_Start + 1) - 1

I would be grateful for any assistance in letting me know how the above can be converted into an SSRS expression.

Many thanks

Graeme Wilson
  • 13
  • 1
  • 3
  • So will your parameter always by the first of any given month? e.g. your parameter will be `01-Nov-2014` and you want your expression result to be `30-Nov-2014`? – Ian Preston Nov 10 '14 at 12:37
  • If so, probably a duplicate of http://stackoverflow.com/questions/2852874/how-do-i-get-the-last-day-on-the-month-using-sql-reporting-services – Ian Preston Nov 10 '14 at 12:48
  • Hi Ian, No it will always be a month end date. Effectively if my parameter is 30-Nov-2014 I would like the expression to pull back 31-12-2014. – Graeme Wilson Nov 10 '14 at 12:53

1 Answers1

1

You need to use DateInterval and then . interval type with SSRS. Plus you cannot just add or minus to a date you need to use DateAdd so I have nested it as follows:

=DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, DateAdd(DateInterval.Day, 1, Parameters!Mth_Start.Value)))

Hope this helps, :-)

barns.dev
  • 48
  • 7