Numeric Functions
Numeric Functions
Functions for performing mathematical operations on numbers. These examples are self-contained; replace literals with model concepts for per-row calculations. Use +, -, *, /, %, and ** for arithmetic expressions.
ABS
Computes the absolute value of a numeric argument.
ROUND
Rounds the first numeric argument to the number of decimal places specified by the second integer argument. If the second argument is omitted or zero, rounds to the nearest integer.
SQRT
Calculates the square root of a non-negative numeric argument. The result is typically a FLOAT or NUMBER.
RANDOM
Returns a random floating-point value between 0.0 (inclusive) and 1.0 (exclusive) at the grain of the provided concept. If no concept is provided, all rows have the same value.
ADD
Adds two numeric arguments. Chain the + operator to add more values.
SUBTRACT
Subtracts the second numeric argument from the first. Takes two arguments.
MULTIPLY
Multiplies two numeric arguments. Chain the * operator for more factors.
DIVIDE
Divides the first numeric argument by the second. Takes two arguments. Use nullif(denominator, 0) when a zero denominator should produce NULL.
MOD
Computes the modulo (remainder) of the first numeric argument divided by the second integer argument.
POWER
Use the ** operator to raise a number to a power.
LOG
Calculates the logarithm of the first argument in the integer base supplied as the optional second argument. The default base is 10.
FLOOR
Rounds a number down to the nearest integer.
CEIL
Rounds a number up to the nearest integer.