I am trying to divide two columns:

([Location_Total_Count_Out_By_Location_Category] / [Location_Total_Inventory_Count_By_Location_Category])

It doesn’t give me a percent. It gives - 0%

I am trying to divide two columns:

([Location_Total_Count_Out_By_Location_Category] / [Location_Total_Inventory_Count_By_Location_Category])

It doesn’t give me a percent. It gives - 0%

There are several things that it could be.

- 0% is a percent. Are either or both of the values 0?
- Is the output column setup as a percent?
- How many decimal places are allowed? I believe that 0 is the default.
- Are the two input columns setup as numbers?

ok. So the values are not “0” for any of them - so that can’t be it.

Output column is - type = “percent”

I put - no decimal places ( i tried 2 as well - still nothing)

the two input columns are type = “number”

Are these configurations correct?

Try:

```
([Location_Total_Count_Out_By_Location_Category] / DECIMAL([Location_Total_Inventory_Count_By_Location_Category]))
```

When dividing two *Number* values, the result will always be a *Number* value. *Number* values have no decimal point, so any fractional component is lost. To avoid this, convert one or both *Number* values to *Decimal* by using the *DECIMAL()* function as above, or by multiplying the *Number* by 1.0.

3 Likes

Steve- that worked. THANKS again!

1 Like

Hi @Steve, can you note this in documentation? The extra step you pointed out is not entirely obvious. It took me about 2 weeks to figure this out by finding your post.

1 Like

Yeah, I realized this when I submit a bug report to support@appsheet, that number divided by number always return the number. This is strange, there will be loads of people who may face the same problem and wasting time.

I reckon Appsheet dev team is aware of and they will try to give a fix to give decimal type for the math, number divided by number. Rounding up is not what app user and creator expects as a result of such a math.

We are aware of the issue. It would have been better to do decimal division in the first place, which is a lot more intuitive (especially for non-programmers). Unfortunately, changing it can break apps that were otherwise working.

The first priority here is to update the docs and make this behavior explicit, which we can do without much delay.

From there, it’s not difficult to change this behavior, it’s a matter of managing the consequences. Ideally we’d have some kind of versioning system for expressions that would allow users to opt in or out of breaking changes like this, but that’s a large project.