SSRS Default Date Parameter Functions

Several months ago, I made a list of date functions I commonly used to set the default value of an SSRS Parameter. I put it on our internal network for my colleagues, and today figured I may as well publish it on my blog too.

Function Description
=DateSerial(Year(Now()), Month(Now()), Day(Now()))
1st of Current Month
=DateSerial(Year(Now()), Month(Now()), 1)
1st of Last Month
=DateSerial(Year(Now()), Month(Now())-1, 1)
1st of Current Year
=DateSerial(Year(Now()), 1, 1)
Last of Current Month
=DateAdd(“S”, -1, DateSerial(Year(Now()), Month(Now())+1,1))
Last of Last Month
=DateAdd(“S”, -1, DateSerial(Year(Now()), Month(Now()),1))

As with all things, make sure you test before implementing to ensure it does exactly as you need.

If you have a favorite you use regularly, add it to the comments and I’ll include it in the post.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>