title: SSRS - DATEDIFF function requires 3 arguments
body: <p>I have a query in SQL that supports an <code>SSRS</code> report. The report generates this error code: </p>
  
  <blockquote>
    <p><code>"DATEDIFF function requires 3 arguments"</code></p>
  </blockquote>
  
  <p>How do I correct this code?</p>
  
  <pre><code>SELECT  DATEDIFF(YY,d.[Date of Birth],@ReportDate) Age,
          [Borrower   FirstName] + ' '
          + [Borrower LastName] BorrowerName,
          MonthlyIncome,
          DATENAME(MONTH,LoanDate) + ' ' 
          + CONVERT(VARCHAR(10),DATEPART(YY,LoanDate)) FormatedReportMonth,
          LoanAmount,    
          [Purchase Price],
  
              CASE WHEN DATEDIFF(YY,d.[Date of Birth],@ReportDate) &lt; 25 
                              THEN '&lt;=25'
                   WHEN DATEDIFF(YY,d.[Date of Birth],@ReportDate) between 25 and 35 
                              THEN '26-35'
                   WHEN DATEDIFF(YY,d.[Date of Birth],@ReportDate) between 36 and 45 
                              THEN '36-45'    
                   WHEN DATEDIFF(YY,d.[Date of Birth],@ReportDate) &gt; 45 
                              THEN '46+' END AgeGroup,
              CASE WHEN DATEDIFF(YY,d.[Date of Birth],@ReportDate) &lt; 25 
                              THEN 1
                   WHEN DATEDIFF(YY,d.[Date of Birth],@ReportDate) between 25 and 35 
                              THEN 2
                   WHEN DATEDIFF(YY,d.[Date of Birth],@ReportDate) between 36 and 45 
                              THEN 3
                   WHEN DATEDIFF(YY,d.[Date of Birth],@ReportDate) &gt; 45 
                              THEN 4 END AgeGroupOrder    
              INTO        #Financials   
              FROM        dbo.Fact_Financials 
  </code></pre>