title: Displaying Previous Week Date Interval in MS Report Builder
body: <p>I'm trying to display a date Range in Report Builder for &quot;last week&quot;. For example, today is 8/10. So I need to show something like: <strong>&quot;August 02, 2020 to August 08, 2020&quot;</strong></p>
  <p>If I use the following expression as part of an SQL Query it works just fine. But, when I attempt to use this as an Expression in a Textbox in Report Builder, I get an error.</p>
  <pre><code>=format(DateAdd(&quot;week&quot;,-1,DateAdd(&quot;week&quot;,DateDiff(&quot;week&quot;,0,getdate()),0)), &quot;MMMM dd, yyyy&quot;)
  </code></pre>
  <p>This throws an Error when I click Run, that says:</p>
  <blockquote>
  <p>The Value expression for the textrun ‘Textbox14.Paragraphs[0].TextRuns[0]’ contains an error: [BC30451] 'getdate' is not declared. It may be inaccessible due to its protection level.</p>
  </blockquote>
  <p>For the &quot;week&quot; keyword, I've tried double/single quoting it, no quotes, using just &quot;w&quot; with and without quotes/single-quotes. If &quot;week&quot; or &quot;w&quot; is not quoted, the error says <em>'week' is not declared...</em></p>
  <p>However, if I run the following Select Query, I get the correct dates:</p>
  <pre><code>SELECT format(DateAdd(week,-1,DateAdd(week,DateDiff(week,0,getdate()),0)) - 1, 'MMMM dd, yyyy')
  , format(DateAdd(week,-1,DateAdd(week,DateDiff(week,0,getdate()),0)) + 5, 'MMMM dd, yyyy')
  </code></pre>
  <p>Using a &quot;-1&quot; because the result of the first DateAdd() returns the previous Monday. Then the 2nd part is &quot;+5&quot; to get me the previous Saturday's date.</p>
  <p>Lastly, I tried replacing &quot;GetDate()&quot; with &quot;Now()&quot;. When I do this, the report will run. But, the textbox just shows <strong>&quot;#Error&quot;</strong>.</p>
  <p>Any ideas?</p>