App Formula Average Not Working

I have a Virtual formula that calculates the average between two other fields. Whenever I edit the entries the formula calculates correctly;However, once the app syncs the value changes to 0.00%. Any thoughts on this? I have other virtual columns set up the same way that work as expected.

thanks for any help

Solved Solved
0 5 542
1 ACCEPTED SOLUTION

Try wrapping the Number types in DECIMAL() when used with AVERAGE(). E.g. DECIMAL([Direct Run #])

Many computer programs, including AppSheet, handle integer (Number) and real-number (Decimal) math differently. When an expression is entirely integers, the fractional component resulting from any calculations is simply dropped. To avoid losing that precision, you need to convert the integers to real numbers, either by wrapping the number with the DECIMAL() function, or by multiplying the integer by a real number (e.g., [Direct Run #] * 1.0).

View solution in original post

5 REPLIES 5

Steve
Platinum 4
Platinum 4

What are the column types of the columns youโ€™re averaging, and the column type of the virtual column receiving the average?

The two columns I am averaging are both Number Type and the Virtual Column that is receiving the average is Percent Type.

I have the [Direct Run #] / [Production Rate #] = [Direct Run %]

Try wrapping the Number types in DECIMAL() when used with AVERAGE(). E.g. DECIMAL([Direct Run #])

Many computer programs, including AppSheet, handle integer (Number) and real-number (Decimal) math differently. When an expression is entirely integers, the fractional component resulting from any calculations is simply dropped. To avoid losing that precision, you need to convert the integers to real numbers, either by wrapping the number with the DECIMAL() function, or by multiplying the integer by a real number (e.g., [Direct Run #] * 1.0).

The Decimal solution worked. Thanks for your help.

Top Labels in this Space