Why is this not dividing?

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%

0 7 628
7 REPLIES 7

EIG
New Member

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?

Steve
Platinum 4
Platinum 4

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.

Steve- that worked. THANKS again!

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.

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.

Former Community Member
Not applicable

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.

Top Labels in this Space