# Incorrect Syntax

**URL:** <https://www.epiusers.help/t/incorrect-syntax/42922>\
**Category:** Epicor ERP 10\
**Created:** [February 20, 2018, 9:44pm UTC](https://www.epiusers.help/t/incorrect-syntax/42922 "2018-02-20T21:44:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Will79](https://www.epiusers.help/letter_avatar_proxy/v4/letter/w/ea666f/32.png) [@Will79](https://www.epiusers.help/u/Will79)\
**Post date:** [February 20, 2018, 9:44pm UTC](https://www.epiusers.help/t/incorrect-syntax/42922/1 "2018-02-20T21:44:30Z")

</div>

Keep getting an syntax error. I’ve been working on this all day and I can’t find it for the life of me. This is going into a BAQ Calc field.

(convert(decimal, ((DATEDIFF(dd, JobHead.StartDate,GETDATE()) + 1) - (DATEDIFF(wk, JobHead.StartDate,GETDATE()) \* 2) -(CASE WHEN DATENAME(dw, JobHead.StartDate) = ‘Sunday’ THEN 1 ELSE 0 END)  
-(CASE WHEN DATENAME(dw, GETDATE()) = ‘Saturday’ THEN 1 ELSE 0 END)))/  
Nullif((convert(decimal,((DATEDIFF(dd, JobHead.StartDate,JobHead.ReqDueDate) + 1) - (DATEDIFF(wk, JobHead.StartDate,JobHead.ReqDueDate) \* 2)  
-(CASE WHEN DATENAME(dw, JobHead.StartDate) = ‘Sunday’ THEN 1 ELSE 0 END) -(CASE WHEN DATENAME(dw, JobHead.ReqDueDate) = ‘Saturday’ THEN 1 ELSE 0 END)))),0)

---

<div class="post-metadata">

**Author:** ![Will79](https://www.epiusers.help/letter_avatar_proxy/v4/letter/w/ea666f/32.png) [@Will79](https://www.epiusers.help/u/Will79)\
**Post date:** [February 20, 2018, 9:59pm UTC](https://www.epiusers.help/t/incorrect-syntax/42922/2 "2018-02-20T21:59:20Z")

</div>

Found it. Needed an extra parenthesis at the end of the first part before the division. Crazy! One things took me several hours. Gotta love it.
