# 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 more`APPROX_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 N of field X.
`PERCENTILE(X,N) `
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 of the cosine of X.
` ACOS(X) `
Arithmetic ASIN Returns the inverse of the sine of X.
` ASIN(X) `
Arithmetic ATAN Returns the inverse of the tangent of X.
` 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.
` CEIL(X) `
Arithmetic COS Returns the cosine of X.
` 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.
` FLOOR(X) `
Arithmetic LOG Returns the logarithm to base 2 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. 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. 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 hour component of X.
` HOUR(X [,Input Format]) `
Date MINUTE Returns the minutes component of X.
` 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 component of X.
` SECOND(X [,Input Format]) `
TEST DAY JUST A TEST. IGNORE.
` DAY(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 number of X.
` 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 or expression into TYPE. Aggregated fields are not allowed inside CAST.`TYPE` can be `NUMBER` or TEXT.
`CAST(field_expression AS TYPE)`
`HYPERLINK(URL, link label)`
MiscellaneousIMAGECreates Image fields in your data source
`IMAGE(Image URL, [Alternative Text])`
Text CONCAT Returns a text that is the concatenation of X and Y.
` CONCAT(X, Y) `
Text CONTAINS_TEXT Returns true if X contains text, otherwise returns false. Case-sensitive.
` CONTAINS_TEXT(X, text) `
Text ENDS_WITH Returns true if X ends with text, otherwise returns false. Case-sensitive.
` 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.
` LEFT_TEXT(X, length) `
Text LENGTH Returns the number of characters in X.
` LENGTH(X) `
TextLOWERConverts X to lowercase.
`LOWER(X)`
Text REGEXP_EXTRACT Returns first matching substring in X which matches the regular expression pattern.
` REGEXP_EXTRACT(X, regular_expression) `
Text REGEXP_MATCH Returns true if X matches the regular expression pattern, otherwise returns false.
` 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.
` REGEXP_REPLACE(X, regular_expression, replacement)`
Text REPLACE Returns a copy of X with all occurrences of Y in X replaced by Z.
` 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.
` RIGHT_TEXT(X, length) `
` STARTS_WITH(X, text) `
` SUBSTR(X, start index, length) `
` TRIM(X) `
` UPPER(X)`