Skip to main content

Functions

Aggregate functions

Function nameDescription
countcount
sumsum
minminimum
maxmaximum
avgaverage
medianmedian
varvariance
stdevstandard deviation
firstfirst value (over the events are sorted by time)
lastlast value (over the events are sorted by time)
valuesextracts raw vector of values to be aggregated
nth(expression, n)returns nth value counting from 0
time_of_lasttime where the expression was true for the last time
time_of_firsttime where the expression was true for the first time
avg_days_betweenaverage days between expression was true

Math

Function nameDescription
floorReturns the largest integer less than or equal to a number.
ceilReturns the smallest integer greater than or equal to a number.
roundReturns the nearest integer to a number. Round half-way cases away from 0.0.
truncReturns the integer part of a number.
fractReturns the fractional part of a number.
absComputes the absolute value. Returns NAN if the number is NAN.
signumReturns a number that represents the sign of self. 1.0 if the number is positive, +0.0 or INFINITY. -1.0 if the number is negative, -0.0 or
sqrtReturns the square root of a number. Returns NaN if it is a negative number other than -0.0.
expReturns e^x, (the exponential function).
exp2Returns 2^x.
lnReturns the natural logarithm of the number.
log2Returns the base 2 logarithm of the number.
log10Returns the base 10 logarithm of the number.
sinComputes the sine of a number (in radians).
cosComputes the cosine of a number (in radians).
tanComputes the tangent of a number (in radians).
asinComputes the arcsine of a number. Return value is in radians in the range [-pi/2, pi/2] or NaN if the number is outside the range [-1, 1].
acosComputes the arccosine of a number. Return value is in radians in the range [0, pi] or NaN if the number is outside the range [-1, 1].
atanComputes the arctangent of a number. Return value is in radians in the range [-pi/2, pi/2];
expm1Returns e^x - 1 in a way that is accurate even if the number is close to zero.
ln1pReturns ln(1+n) (natural logarithm) more accurately than if the operations were performed separately.
sinhHyperbolic sine function.
coshHyperbolic cosine function.
asinhInverse hyperbolic sine function.
acoshInverse hyperbolic cosine function.
atanhInverse hyperbolic tangent function.
divEuclidDivision rounded toward negative infinity.
remEuclidThe remainder of a division, rounded towards negative infinity.
powfReturns self raised to the power of other.
clampReturns the maximum of the lower limit and the minimum of the upper limit and the value.

Text

Function nameDescription
lenReturns the length of the string.
substrExtracts characters from a string, beginning at a specified start position, and through the specified number of character.
concatConcatenates two strings.
trimRemoves leading and trailing whitespace from a string.
lowerConverts all uppercase letters in a string to lowercase.
upperConverts all lowercase letters in a string to uppercase.
replaceReplaces all occurrences of a substring within a string, with a new substring.
startsWithChecks whether a string starts with specified string.
endsWithChecks whether a string ends with specified string.
containsChecks whether a string contains the specified string/characters.

Regex

Function nameDescription
regexMatchChecks whether a string matches a regular expression.
regexExtractExtracts a portion of a string that matches a regular expression.
regexReplaceReplaces a portion of a string that matches a regular expression.
regexSplitSplits a string around matches of a regular expression.
regexCountReturns the number of matches of a regular expression in a string.

Null Handling

Function nameDescription
coalesceReturns the first non-null value in a list.

Dates

Function nameDescription
yearreturns year - year('2006-01-01') will return 2006
monthreturns month - month('2012-05-01') will return 5
dayreturns month - day('2012-05-10') will return 10
weekreturn calendar week('2021-01-06) will return 1
dateAddAdds an interval to a date.
dateSubSubtracts an interval from a date.
hourReturns the hour of a date.
minuteReturns the minute of a date.
secondReturns the second of a date.
microsecondReturns the microsecond of a date.
datePartReturns the specified part of a date.
extractExtracts a part of a date.
formatDateFormats a date as a string according to a specified format.
nowReturns the current date and time.
currentDateReturns the current date.
currentTimeReturns the current time.
toDateConverts a string to a date.
dateDiffReturns the difference between two dates.
weekdayReturns the weekday of a date.
dayOfYearReturns the day of the year of a date.
quarterReturns the quarter of a date.
isStartOfMonthReturns whether a date is the start of a month.
isEndOfMonthReturns whether a date is the end of a month.
isWeekendReturns whether a date is a weekend.

Control Flow

Function nameDescription
ifReturns one value if a condition is true and another value if