title: date diff function in query of google sheets
body: <p>I got the below result using the formula</p>
  <pre><code>={query(SALES!A2:Y ,&quot;Select B, C, D, G,  P,  Sum(T), datediff(now(), todate(P)) WHERE O ='&quot;&amp;(A1)&amp;&quot;' GROUP BY B, C, D, G, P ORDER BY datediff(now(), todate(P)) DESC Label Sum(T) 'PENDING AMOUNT', datediff(now(), todate(P)) 'OVER DAYS' &quot; ,1)}
  </code></pre>
  <p>Now I need the last column status using if (overdue / underdue based on overdays) using the above formula. pl help</p>
  <pre><code>INV.DATE    INVOICE NUMBER  CUSTOMER NAME   DUE DATE    PENDING AMOUNT  OVER DAYS   STATUS
  15-Apr-2020 IBLR001-2021    abc ltd        15-May-2020  ₹2,46,750       93          OVER DUE
  21-Apr-2020 IBLR002-2021    xyx            20-Aug-2020  ₹5,87,788       -4          UNDER DUE
  </code></pre>