Trying to divide two numbers to get a percentage but always getting 0?
Trying to divide two numbers but losing the numbers after the decimal point?
Convert one or both of the values in your division expression to a Decimal value, either by: (1) wrapping the value in the expression with the DECIMAL() function; (2) multiplying the value in the expression by 1.0; or (3) changing the column’s type to Decimal if suitable to the app.
If computing a percentage from two Number column values:
([Correct Answer Count] / DECIMAL([Question Count]))
([Correct Answer Count] / ([Question Count] * 1.0))
The Number column type represents integers, which are whole numbers, numbers without a fractional component. A Number value has no decimal point.
When one Number value is divided by another Number value, AppSheet assumes you want the result to also by a Number value. If the result has in a fractional component (something after the decimal point), that fractional component is discarded entirely, leaving only the whole number component (the part before the decimal point).
If one or both of the values in a division operation is a Decimal value, AppSheet assumes you want the result to be a Decimal value as well, and will preserve any fractional component in the result.
The DECIMAL() function can be used to convert a Number value to a Decimal value. Multiplying a Number value by 1.0 (a Decimal value) has the same effect.