Search
Clear search
Close search
Google apps
Main menu

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
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 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. 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.
Text CONCAT Returns a text that is the concatenation of X and Y. Note that either X or Y must be an expression that has at least one field; the other can be a text literal. Arguments must be either both aggregated or both unaggregated. CONCAT(X, Y)
Text LENGTH Returns the number of characters in X. LENGTH(Field Or Expr)
TextLOWERConverts X to lowercase.LOWER(Field Or Expr)
Text REGEXP_EXTRACT Returns first matching substring in X which matches regex pattern.
Learn more
REGEXP_EXTRACT(Field Or Expr, Extract regex pattern)
Text REGEXP_MATCH Returns true if X matches Y, false otherwise.
Learn more
REGEXP_MATCH(X, Reg Expr)
Text REGEXP_REPLACE Replaces all occurences of text which matches the regex in X with the replacement string.
Learn more
REGEXP_REPLACE(A, '[a-z]+', 'A')
Text REPLACE Returns a copy of X with all occurrences of Y in X replaced by Z. REPLACE(Field Or Expr, Existing Literal, Replacement Literal)
Text SUBSTR Returns a text that is subtext of X. The subtext consists of X[Y], X[Y+1], ..., X[Y+Z-1]. SUBSTR(Field Or Expr, Start Index, Length)
Text TRIM Returns X with leading and trailing whitespace removed. TRIM(Field Or Expr)
Text UPPERConverts X to uppercase. UPPER(Field Or Expr)