# Subtracting dates in BAQ calculated field?

**URL:** <https://www.epiusers.help/t/subtracting-dates-in-baq-calculated-field/54175>\
**Category:** Epicor ERP 10\
**Tags:** baq\
**Created:** [April 1, 2019, 4:27pm UTC](https://www.epiusers.help/t/subtracting-dates-in-baq-calculated-field/54175 "2019-04-01T16:27:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lalbrecht](https://www.epiusers.help/user_avatar/www.epiusers.help/lalbrecht/32/15768_2.png) [@lalbrecht](https://www.epiusers.help/u/lalbrecht)\
**Post date:** [April 1, 2019, 4:27pm UTC](https://www.epiusers.help/t/subtracting-dates-in-baq-calculated-field/54175/1 "2019-04-01T16:27:57Z")

</div>

I am moving BAQs over from E9 to E10, and this is the logic for the E9 calculated field I’m trying to duplicate.

(integer(ShipHead.ShipDate) - integer(OrderRel.ReqDate))

When I use that exactly in E10, I get the error 'integer is not a recognized built-in function name.  
I already tried simply exporting the BAQ and importing it in E10, it worked for most, but this one said ‘Bad SQL Statement’ so I am rebuilding it. If you have another suggestion that would help also.

Thanks,  
Logan

---

<div class="post-metadata">

**Author:** ![Banderson](https://www.epiusers.help/user_avatar/www.epiusers.help/banderson/32/50875_2.png) [@Banderson](https://www.epiusers.help/u/Banderson)\
**Post date:** [April 1, 2019, 4:41pm UTC](https://www.epiusers.help/t/subtracting-dates-in-baq-calculated-field/54175/2 "2019-04-01T16:41:17Z")

</div>

> **[SQL Server DATEDIFF() Function](https://www.w3schools.com/sql/func_sqlserver_datediff.asp)**
>
> W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

![image](https://www.epiusers.help/uploads/default/original/2X/8/81e6eb43967148c8ef3d530827b0d16440070c2a.png)

---

<div class="post-metadata">

**Author:** ![lalbrecht](https://www.epiusers.help/user_avatar/www.epiusers.help/lalbrecht/32/15768_2.png) [@lalbrecht](https://www.epiusers.help/u/lalbrecht)\
**Post date:** [April 1, 2019, 4:45pm UTC](https://www.epiusers.help/t/subtracting-dates-in-baq-calculated-field/54175/3 "2019-04-01T16:45:44Z")

</div>

You’re the man, @Banderson !  
Worked!  
Thanks!

---

<div class="post-metadata">

**Author:** ![Banderson](https://www.epiusers.help/user_avatar/www.epiusers.help/banderson/32/50875_2.png) [@Banderson](https://www.epiusers.help/u/Banderson)\
**Post date:** [April 1, 2019, 4:47pm UTC](https://www.epiusers.help/t/subtracting-dates-in-baq-calculated-field/54175/4 "2019-04-01T16:47:11Z")

</div>

Just remember that almost anything in SQL works in the calculated fields, so if you google SQL and whatever you are trying to do, 9 times out of 10, you can type it in. Luckily SQL is very well documented too, and lots of answers online.

---

<div class="post-metadata">

**Author:** ![lalbrecht](https://www.epiusers.help/user_avatar/www.epiusers.help/lalbrecht/32/15768_2.png) [@lalbrecht](https://www.epiusers.help/u/lalbrecht)\
**Post date:** [April 1, 2019, 4:47pm UTC](https://www.epiusers.help/t/subtracting-dates-in-baq-calculated-field/54175/5 "2019-04-01T16:47:58Z")

</div>

Awesome!
