title: Formula for default date parameter in SSRS
body: <p>I'm fairly new to SSRS and have a simple report that I want to schedule to run either daily or weekly. Of course if it is running daily then I want the date start and end dates to be yesterday. If weekly I want the start date to be yesterday - 7 days. </p>
  
  <p>This is the formula I use for start date:</p>
  
  <blockquote>
    <p>=iif(Parameters!showDetails.Value = true, DateAdd("d", -1, DateValue(Now())), DateAdd("d", -7, DateValue(Now()))) ></p>
  </blockquote>
  
  <p>The formula seems to work fine if I just include it in the report, however if I use the formula for the Non-queried default value for the StartDate parameter. I get this error: Error during processing of 'startDate' report parameter. showDetails in this case is a simple Boolean report parameter that is used to select the weekly or daily report format which basically hides the detail headers and lines of the report leaving only the group headers and footers for the report if false.</p>
  
  <p>This report is running on SSRS 2005 if that makes a difference.</p>
  
  <p>Thanks for any advice or suggestions.</p>