SQL issue: cannot construct data type date some of the arguments have values which are not valid
<p>I am working on an Excel project where I use SQL query to extract some data from SQL Server 2012.</p>

<p>When I select the data without filters, everything works fine.</p>

<p>However, when I use the <code>DATEFORMATPARTS</code> formula below, I get this error:</p>

<blockquote>
  <p>Cannot construct data type date some of the arguments have values which are not valid</p>
</blockquote>

<p><code>A.[Invoice date]</code> is the correct date format.</p>

<pre><code>WHERE 
    A.[Customer] NOT IN ('100', '398', 399) 
    AND A.[Item] LIKE '1%'
    AND A.[Invoice date] &gt;= DATEFROMPARTS(Year(DATEADD(yyyy, -1, GETDATE())), Month(DATEADD(yyyy, -1, GETDATE()) &gt;) + 1, 1)
</code></pre>

<p>I've tried a lot of different stuff, but without luck.</p>

<p>Any guesses what is wrong in the above.</p>

<p>Thanks a lot in advance!</p>

<p>/ T</p>