I want to round line items of orders and then sum the aggregate of the rounded values. Is it possible to round line items UP and then SUM them?

48 views Asked by At

Essentially the query works like this:

Select Sum(Ceiling((Exp_Cart)*Exp_Qty) from Table_X where Item in ('3')

I am receiving an error in my query and wondering if there is a better way to approach this.

The situation is I need to count whole cartons, and a lot of our data has cartons in fractions / sometimes we sell at quantities that result in partial cartons. For capacity purposes, we always round up.

Select Sum(Ceiling((Exp_Cart)*Exp_Qty) from Table_X where Item in ('3')

I expect it to round up IE:

Carton = 0.25
Quantity = 4
Multiply gives me 1 carton

Sometimes we have orders of odd quantities which leads to partial cartons

Carton = 0.25
Quantity = 5
Multiply now gives me 1.25, which I want to round up to 2.

We then need to sum up all of the quantities to provide the correct carton-level information.

0

There are 0 answers