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. AVG(X)
Aggregation COUNT Returns the number of values of X. COUNT(X)
Aggregation COUNT_DISTINCT Returns the number of unique values of X. COUNT_DISTINCT(X)
Aggregation MAX Returns the maximum value of X. MAX(X)
Aggregation MEDIAN Returns the median of all values of X. MEDIAN(X)
Aggregation MIN Returns the minimum value of X. MIN(X)
Aggregation PERCENTILE Returns the percentile rank Y of field X. PERCENTILE(X,Y)
Aggregation STDDEV Returns the standard deviation of X. STDDEV(X)
Aggregation SUM Returns the sum of all values of X. SUM(X)
AggregationVARIANCEReturns the variance of X. VARIANCE(X)
Arithmetic ABS Returns the absolute value of number. ABS(X)
Arithmetic ACOS Returns the inverse hyperbolic cosine of X. ACOS(X)
Arithmetic ASIN Returns the inverse hyperbolic sine of X. ASIN(X)
Arithmetic ATAN Returns the inverse hyperbolic tangent of X. ATAN(X)
Arithmetic CEIL Returns the smallest integral value of X. For example, if the value of X is v, CEIL(X) is greater than or equal to v. CEIL(X)
Arithmetic COS Returns the cosine of X. COS(X)
Arithmetic FLOOR Returns the largest integral value of X. For example, if the value X is v, FLOOR(X) is equal to or less than v. FLOOR(X)
Arithmetic LOG Returns the natural logarithm of X. LOG(X)
Arithmetic LOG10 Returns the logarithm to base 10 of X. LOG10(X)
Arithmetic NARY_MAX Returns the maximum value of X, Y, [,Z]*. All input arguments must be of the same type: all numbers or all text. At least one input argument must be a field or an expression containing a field. 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 or all text. At least one input argument must be a field or an expression containing a field. NARY_MIN(X, Y, [Z]*)
Arithmetic POWERReturns result of raising X to the power Y. POWER(X, Y)
Arithmetic ROUND Returns X rounded to Y precision digits. ROUND(X, Y)
Arithmetic SIN Returns the sine of X. SIN(X)
Arithmetic SQRT Returns the square root of X. Note that X must be non-negative. SQRT(X)
Arithmetic TAN Returns the tangent of X. TAN(X)
Date DATE_DIFF Returns the difference in days between X and Y (X - Y). DATE_DIFF(X, Y)
Date DAY Returns the day of X. DAY(X, Input Format)
Date HOUR Returns the hours in X in UTC timezone. HOUR(X, Input Format)
Date MINUTE Returns the minutes in X in UTC timezone. MINUTE(X, Input Format)
Date MONTH Returns the month in X. MONTH(X, Input Format)
Date QUARTER Returns the quarter of X. QUARTER(X, Input Format)
Date SECOND Returns the seconds in X in UTC timezone. 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. WEEK(X)
Date WEEKDAY Returns the day of the week of X. WEEKDAY(X, Input Format)
Date YEAR Returns the year of X. YEAR(X, Input Format)
Date YEARWEEK Returns the year and week of X as per ISO 8601 standard. YEARWEEK(X)
Geo TOCITY Returns the city name for X. TOCITY(X, Input Format)
Geo TOCONTINENT Returns the continent name for X. TOCONTINENT(X, Input Format)
Geo TOCOUNTRY Returns the country name for X. TOCOUNTRY(X, Input Format)
Geo TOREGION Returns the region name for X. TOREGION(X, Input Format)
Geo TOSUBCONTINENT Returns the sub-continent name for X. 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_expression AS TYPE)Cast field or expression into TYPE. Aggregated fields are not allowed inside CAST.

TYPE can be NUMBER or TEXT.
TextHYPERLINKReturns a hyperlink to the URL, labeled with the Link Text. Learn more. HYPERLINK(URL, Link Label)
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)