Distribute the volume into boxes without decimal places

Hello Everyone!

I hope you’re doing well!

I’m trying to distribute a volume in boxes to some stores. I calculated the sales percentage based on the product’s sales in each store using the formula Quantity in Cartons * Distribution Percentage - Sales percentage. However, this gives me a number with decimal places, and I can’t send half a box to a store, haha, lol!

Is there a way to handle this? If I use the round formula, it might round up or down, causing me to miss sending all the boxes I have.

Maybe using a loop would help, but I’m not sure how to go about it…

In the example below, the distribution is done manually, but I’m looking for a more automated formula or approach.

KNIME WORKFLOW BELOW


Distribute the volume into boxes without decimal places.knwf (7.8 KB)

Hi @gabrielfs2

Your logic behind the expected outcome is not consistent which makes it hard to apply rules to this. Could you elaborate on this?

To illustrate, why does 0,20 equal 0 while 0,22 equals 1. Why does 10,66 equal 10 while 1,66 equals 2. It seems like 90% is round up or down the normal way but there are a few outliers there.

If you talk about whole boxes, I’d say you’re best off with the floor() function.

1 Like

These were values ​​that the end user entered manually, I added them just to illustrate that in the end it had to be a whole number and that it had to contain all the boxes

sorry for my lack of clarity

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.