Numeric Equation Functions

Notes:

  • The functions listed in this article are only available for equation fields. If you're looking for the functions available for text formula fields, see our article here.
  • The equation type must be set to "numeric" to use most of these functions.
  • Functions such as****min** ** and max**** can also be used in Date Equations.

Many regular math functions (such as "ceil" or "max") can be used in Knack numeric equations. Others, such as getDateDayOfMonth provide numeric values for a date.

NameDescriptionExample with Result
absCalculates the absolute value of a numberabs(3.85) = 4
cbrtCalculate the cube root of a numbercbrt(27) = 3
ceilRound a value up to the nearest integerceil(4.2) = 5
cosCalculate the cosine of a numbercos(2) = -0.4161468365471424
factorialCompute the factorial of a numberfactorial(5) = 120
floorRound a value down to the nearest integerfloor(2.8) = 2
gcdCalculate the greatest common denominator of a comma-separated list of numbersgcd(5, 25) = 5
logCalculate the logarithm of a number. The first number is the value for which to calculate, the second is the base.log(10,4) = 1.6609640474436813
log10Calculate a base 10 logarithm. Same as log(x, 10)log10(4) = 0.6020599913279623
maxGet the maximum of a comma-separated list of valuesmax(1,6,9) = 9
meanCompute the mean of a list of valuesmean(1,6,8) = 5
medianCompute the median of a list of valuesmedian(8,9,1) = 8
minGet the minimum of a list of valuesmin(43,100,3) = 3
powCalculate the base to the exponent powerpow(7,2) = 49
randomGet a random number between two valuesrandom(1,42) = 36.238172
randomIntGet a random integer within a specified range. Please note that the returned value can be inclusive of the first integer but exclusive of the second integer listed in the parentheses.randomInt(1,42) = 36 (Possible values returned can be 1-41.)
roundRounds the first number to the precision of the second numberround(5.5,3) = 6
signCalculate the sign of a number: -1 if the number is less than 0, 1 if the number is greater than 0, 0 if the number is 0sign(2) = 1
sinCalculate the sine of a numbersin(15) = 0.6502878401571168
stdCompute the standard deviation of a list of valuesstd(1,5,42,78) = 36.07861785970558
sqrtCalculate the square root of a numbersqrt(81) = 9
sumCompute the sum of a list of valuessum(1,42,56) = 99
tanCalculate the tangent of a numbertan(16) = 0.3006322420239034
varCompute the variance of a list of valuesvar(1,42,34,67) = 742
netWorkDaysGet the number of working/business days between two datesnetWorkDays(06/18/2018,06/27/2018) = 7

**Note: **The netWorkDays function calculates the total number of working days between two dates, considering only Monday to Friday.

If your dates include time, it does not take into account working hours (e.g. 9 am-5 pm). The function only will count for a full 24-hour day.

The following examples use April 15, 2017, as the date:

getDateDayOfWeekGet the numeric day of the week from a Date (Sunday = 1)getDateDayOfWeek((Date)) = 7
getDateDayOfMonthGet the numeric day of the month from a DategetDateDayOfMonth((Date)) = 15
getDateWeekGet the numeric week of the year from a DategetDateWeek((Date)) = 15
getDateMonthGet the numeric month from a DategetDateMonth((Date)) = 4
getDateQuarterGet the numeric quarter from a DategetDateQuarter((Date)) = 2
getDateYearGet the numeric year from a DategetDateYear((Date)) = 2017