Set default parameter dates to start and end of month

The requirement in a lot of my reports in SSRS has always been a date range rather than just the one date. The user must be allowed to select all results between two dates instead of just specifying the one day. If the second parameter (ToDate) is the same as the first (FromDate), then the range is for that particular date.

Easy for some but anything that I spend 30 minutes googling and reading up on is asking for an article on my own site. Besides this is how I did it and what worked for me...

Set the default values for your from and to date respectively:
-- From Date (european format - dd/mm/yyyy)
=CDate("01/" + cstr(month( + "/" + cstr(year(

-- To Date (european format - dd/mm/yyyy)
=dateadd("d",-1, CDate("01/" + cstr(month( + "/" + cstr(year( )

-- From Date (american format - mm/dd/yyyy)
=CDate(cstr(month( + "/1/" + cstr(year(

-- To Date (american format - mm/dd/yyyy)
=dateadd("d",-1, CDate(cstr(month( + "/1/" + cstr(year( )
  1.  -- From Date (european format - dd/mm/yyyy) 
  2.  =CDate("01/" + cstr(month( + "/" + cstr(year( 
  4.  -- To Date (european format - dd/mm/yyyy) 
  5.  =dateadd("d",-1, CDate("01/" + cstr(month( + "/" + cstr(year( ) 
  7.  -- From Date (american format - mm/dd/yyyy) 
  8.  =CDate(cstr(month( + "/1/" + cstr(year( 
  10.  -- To Date (american format - mm/dd/yyyy) 
  11.  =dateadd("d",-1, CDate(cstr(month( + "/1/" + cstr(year( ) 
This idea was based on Bob Griffin's post on SQL Server forums where he subtracts 1 day from the first day of next month to get the last date/number of days in this month.
Category: SQL Server Reporting Services :: Article: 337

Credit where Credit is Due:

Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: The information on this website is provided without warranty and any content is merely the opinion of the author. Please try to test in development environments prior to adapting them to your production environments. The articles are written in good faith and, at the time of print, are working examples used in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman

Related Articles

Joes Revolver Map

Joes Word Cloud


Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Donate to Joel Lipman via PayPal

Donate to Joel Lipman with Bitcoin - Valid till 8 May 2022 bc1qjtp4l4ra452wzvuk9a45yfj82zkahsyy2z379y
© 2022 Joel Lipman .com. All Rights Reserved.