Function list

Data Studio provides a number of powerful functions that can be used inside of calculated field formulas. 

More information on each function, including examples, is available in the formula editor. This help will appear as you begin to type your formula.
TypeNameDescriptionSyntax
AggregationAPPROX_COUNT_DISTINCTReturns the approximate number of unique values of X. Learn moreAPPROX_COUNT_DISTINCT(X)
Aggregation AVG Returns the average of all values of X.
Learn more.
AVG(X)
Aggregation COUNT Returns the number of values of X.
Learn more.
COUNT(X)
Aggregation COUNT_DISTINCT Returns the number of unique values of X.
Learn more.
COUNT_DISTINCT(X)
Aggregation MAX Returns the maximum value of X.
Learn more.
MAX(X)
Aggregation MEDIAN Returns the median of all values of X.
Learn more.
MEDIAN(X)
Aggregation MIN Returns the minimum value of X.
Learn more.
MIN(X)
Aggregation PERCENTILE Returns the percentile rank N of field X.
Learn more.
PERCENTILE(X,N)
Aggregation STDDEV Returns the standard deviation of X.
Learn more.
STDDEV(X)
Aggregation SUM Returns the sum of all values of X.
Learn more.
SUM(X)
AggregationVARIANCEReturns the variance of X.
Learn more.
VARIANCE(X)
Arithmetic ABS Returns the absolute value of number.
Learn more.
ABS(X)
Arithmetic ACOS Returns the inverse of the cosine of X.
Learn more.
ACOS(X)
Arithmetic ASIN Returns the inverse of the sine of X.
Learn more.
ASIN(X)
Arithmetic ATAN Returns the inverse of the tangent of X.
Learn more.
ATAN(X)
Arithmetic CEIL Returns the nearest integer greater than X. For example, if the value of X is v, CEIL(X) is greater than or equal to v.
Learn more.
CEIL(X)
Arithmetic COS Returns the cosine of X.
Learn more.
COS(X)
Arithmetic FLOOR Returns the nearest integer less than X. For example, if the value X is v, FLOOR(X) is equal to or less than v.
Learn more.
FLOOR(X)
Arithmetic LOG Returns the logarithm to base 2 of X.
Learn more.
LOG(X)
Arithmetic LOG10 Returns the logarithm to base 10 of X.
Learn more.
LOG10(X)
Arithmetic NARY_MAX Returns the maximum value of X, Y, [,Z]*. All input arguments must be of the same type: all numbers. At least one input argument must be a field or an expression containing a field.
Learn more.
NARY_MAX(X, Y [,Z]*)
Arithmetic NARY_MIN Returns the minimum value of X, Y, [,Z]*. All input arguments must be of the same type, all numbers. At least one input argument must be a field or an expression containing a field.
Learn more.
NARY_MIN(X, Y [,Z]*)
Arithmetic POWERReturns result of raising X to the power Y.
Learn more.
POWER(X, Y)
Arithmetic ROUND Returns X rounded to Y precision digits.
Learn more.
ROUND(X, Y)
Arithmetic SIN Returns the sine of X.
Learn more.
SIN(X)
Arithmetic SQRT Returns the square root of X. Note that X must be non-negative.
Learn more.
SQRT(X)
Arithmetic TAN Returns the tangent of X.
Learn more.
TAN(X)
Date DATE_DIFF Returns the difference in days between X and Y (X - Y).
Learn more.
DATE_DIFF(X, Y)
Date DAY Returns the day of X.
Learn more.
DAY(X [,Input Format])
Date HOUR Returns the hour component of X.
Learn more.
HOUR(X [,Input Format])
Date MINUTE Returns the minutes component of X.
Learn more.
MINUTE(X [,Input Format])
Date MONTH Returns the month in X.
Learn more.
MONTH(X [,Input Format])
Date QUARTER Returns the quarter of X.
Learn more.
QUARTER(X [,Input Format])
Date SECOND Returns the seconds component of X.
Learn more.
SECOND(X [,Input Format])
Date TODATE Returns the datetime field in the specified format in UTC. Learn more. TODATE(X, Input Format, Output Format)
Date WEEK Returns the week of X from start of year as per ISO 8601 standard.
Learn more.
WEEK(X)
Date WEEKDAY Returns the day of the week of X.
Learn more.
WEEKDAY(X [,Input Format])
Date YEAR Returns the year of X.
Learn more.
YEAR(X [,Input Format])
Date YEARWEEK Returns the year and week number of X.
Learn more.
YEARWEEK(X)
Geo TOCITY Returns the city name for X. TOCITY(X [,Input Format])
Geo TOCONTINENT Returns the continent name for X.
Learn more.
TOCONTINENT(X [,Input Format])
Geo TOCOUNTRY Returns the country name for X.
Learn more.
TOCOUNTRY(X [,Input Format])
Geo TOREGION Returns the region name for X.
Learn more.
TOREGION(X [,Input Format])
Geo TOSUBCONTINENT Returns the sub-continent name for X.
Learn more.
TOSUBCONTINENT(X [,Input Format])
MiscellaneousCASEEvaluates to exactly one value based on a set of given boolean expressions. Learn more
CASE
  WHEN C = 'yes'
  THEN 'done:yes'
  ELSE 'done:no'
END
MiscellaneousCASTCast field or expression into TYPE. Aggregated fields are not allowed inside CAST.TYPE can be NUMBER or TEXT.
Learn more.
CAST(field_expression AS TYPE)
MiscellaneousHYPERLINKReturns a hyperlink to the URL, labeled with the link label.
Learn more.
HYPERLINK(URL, link label)
MiscellaneousIMAGECreates Image fields in your data source
Learn more.
IMAGE(Image URL, [Alternative Text])
Text CONCAT Returns a text that is the concatenation of X and Y.
Learn more.
CONCAT(X, Y)
Text CONTAINS_TEXT Returns true if X contains text, otherwise returns false. Case-sensitive.
Learn more.
CONTAINS_TEXT(X, text)
Text ENDS_WITH Returns true if X ends with text, otherwise returns false. Case-sensitive.
Learn more.
ENDS_WITH(X, text)
Text LEFT_TEXT Returns a number of characters from the beginning of X. The number of characters is specified by length.
Learn more.
LEFT_TEXT(X, length)
Text LENGTH Returns the number of characters in X.
Learn more.
LENGTH(X)
TextLOWERConverts X to lowercase.
Learn more.
LOWER(X)
Text REGEXP_EXTRACT Returns first matching substring in X which matches the regular expression pattern.
Learn more.
REGEXP_EXTRACT(X, regular_expression)
Text REGEXP_MATCH Returns true if X matches the regular expression pattern, otherwise returns false.
Learn more.
REGEXP_MATCH(X, regular_expression)
Text REGEXP_REPLACE Replaces all occurrences of text which matches the regular expression pattern in X with the replacement string.
Learn more.
REGEXP_REPLACE(X, regular_expression, replacement)
Text REPLACE Returns a copy of X with all occurrences of Y in X replaced by Z.
Learn more.
REPLACE(X, Y, Z)
Text RIGHT_TEXT Returns a number of characters from the end of X. The number of characters is specified by length.
Learn more.
RIGHT_TEXT(X, length)
Text STARTS_WITH Returns true if X starts with text. Otherwise, returns false. Case-sensitive.
Learn more.
STARTS_WITH(X, text)
Text SUBSTR Returns a text that is a substring of X. The substring begins at start index and is length characters long.
Learn more.
SUBSTR(X, start index, length)
Text TRIM Returns X with leading and trailing spaces removed.
Learn more.
TRIM(X)
Text UPPERConverts X to uppercase.
Learn more.
UPPER(X)