BAQ turning yellow and not returning all results after adding a calculated field for %

Hello,

I hope someone can help me, I have created a BAQ to calculate the profit of sales orders based on the part cost. I am able to get all of the information required until I add a calculated field for percent. When I test, only some results come back and the grid turns yellow.

Any help is appreciated! Thanks in advance.
Jennifer

Are you checking for possible divide by zero errors?

Change the field that calculates the percent from (in the very pseudo code …)
(Price - Cost) / Cost
to
(case when cost = 0 then 0 else (Price - Cost) / Cost end)

3 Likes

If the analyze button doesn’t tell you anything you can find the SQL error results in the event viewer on the server. My guess is that you are trying to divide by zero somewhere along the way. To verify, create a CASE statement that checks for the price to not be zero before you do your division.

If you post your BAQ script on the front of your BAQ screen the code can be analyzed further.

Ross

1 Like

Thank you so much guys!!! I knew that was the issue, but didn’t know how to fix it! :slight_smile:
I love this group!!! :slight_smile: I am learning so much about the tools side