Search code examples
reporting-servicesparametersssrs-2008expressionssrs-2008-r2

How To Specify Two Default Dates In Parameter


I'm using the following expression to pull a default date from yesterday:

=DateAdd("d",-1,Today())

The business requirements changed and now they want to see yesterday AND today. Is it possible to add onto this expression to include yesterday and today?


Solution

  • Just set the parameter to yesterday date and change this in your query.

    WHERE [DateColumn] >= @DataParam
    

    If you want to show the dates the report is using, try this in a textbox:

    ="Dates: " & Parameters!DateParam.Value & "-" Today()
    

    UPDATE: If your parameter is multivalued you have to add two default values using these expression:

    =Today()
    


    =Today.AddDays(-1)
    

    Then in your query change this:

    WHERE [DateColumn] IN (@DateParam)
    

    Let me know if this helps.