Data Studio is now Looker Studio. Looker Studio is still free, with the same features you already know. Looker Studio Pro offers improved asset management for enterprises, new team collaboration capabilities, and access to technical support. Learn more.

# Function list

Looker 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 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) `
ConditionalCASEEvaluates the `condition` of each successive WHEN clause and returns the first `result` where the `condition` is true; any remaining WHEN and ELSE clauses are not evaluated. If all conditions are false or NULL, returns `else_result` if present; if not present, returns NULL. Learn more
```
```CASE
WHEN condition THEN result
[WHEN condition THEN result]
[...]
[ELSE else_result]
END``````
ConditionalCASE (Simple)Compares `input_expression` to `expression_to_match` of each successive WHEN clause and returns the first `result` where this comparison returns true. Learn more
```
```CASE input_expression
WHEN expression_to_match THEN result
[WHEN expression_to_match THEN result]
[...]
[ELSE result]
END``````
ConditionalCOALESCEReturns the first non-missing value found in a list of fields.
`COALESCE(field_expression[,field_expression, ...])`
ConditionalIFNULLReturns a result if the input is null, otherwise, returns the input.
`IFNULL(input_expression, null_result)`
ConditionalIFIf `condition` is true, returns `true_result`, else returns `false_result`. `false_result` is not evaluated if `condition` is true. `true_result` is not evaluated if `condition` is false or NULL. Learn more `IF(condition, true_result, false_result) `
ConditionalNULLIFReturns null if the input matches an expression, otherwise returns the input.
`NULLIF(input_expression, expression_to_match)`
Date CURRENT_DATE Returns the current date as of the specified or default timezone.
` CURRENT_DATE([time_zone]) `
Date CURRENT_DATETIME Returns the current date and time as of the specified or default timezone.
` CURRENT_DATETIME([time_zone]) `
Date DATE Constructs a Date field or value from numbers or from a Date & Time field or expression.
`DATE(year, month, day)`
Date DATE_DIFF Returns the difference in days between X and Y (X - Y).
` DATE_DIFF(X, Y) `
Date DATE_FROM_UNIX_DATE Interprets an integer as the number of days since 1970-01-01.
` DATE_FROM_UNIX_DATE(integer) `
Date DATETIME Constructs a Date & Time field or value from numbers.
` DATETIME(year, month, day, hour, minute, second) `
`DATETIME_ADD(datetime_expression, INTERVAL integer part)`
Date DATETIME_DIFF Returns the number of part boundaries between two dates.
`DATETIME_DIFF(date_expression, date_expression, part)`
Date DATETIME_SUB Subtracts a specified time interval from a date.
``` DATETIME_SUB(datetime_expression, INTERVAL integer part) ```
Date DATETIME_TRUNC Truncates a date to the specified granularity.
` DATETIME_TRUNC(date_expression, part) `
Date DAY Returns the day of a Date or Date & Time.
` Day(date_expression) `
Date EXTRACT Returns part of a Date or Date & Time.
` EXTRACT(part FROM date_expression) `
Date FORMAT_DATETIME Returns a formatted date string.
`FORMAT_DATETIME(format_string, datetime_expression)`
Date HOUR Returns the hour of a date and time.
` HOUR(datetime_expression) `
Date MINUTE Returns the minutes component of a given date and time.
` MINUTE(datetime_expression) `
Date MONTH Returns the month from a Date & Time value.
` MONTH(date_expression)`
Date PARSE_DATE Converts text to a date.
`PARSE_DATE(format_string, text)`
Date PARSE_DATETIME Converts text to a date with time.
`PARSE_DATETIME(format_string, text)`
Date QUARTER Returns the quarter of the year for a given date.
` QUARTER(date_expression) `
Date SECOND Returns the seconds component of a given date and time.
` SECOND(datetime_expression) `
Date TODATE Returns a formatted compatibility mode Date. Learn more. ` TODATE(X, Input Format, Output Format) `
Date TODAY Returns the current date as of the specified or default timezone.
` TODAY([time_zone]) `
Date UNIX_DATE Returns the number of days since 1970-01-01.
` UNIX_DATE(date_expression) `
Date WEEK Returns the week number for a given date.
` WEEK(Date) `
Date WEEKDAY Returns a number representing the day of the week for a given date.
` WEEKDAY(Date) `
Date YEAR Returns the year of a given date.
` YEAR(Date) `
Date YEARWEEK Returns the year and week number of a given date.
` YEARWEEK(Date) `
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]) `
MiscellaneousCASTCast field or expression into TYPE. Aggregated fields are not allowed inside CAST.`TYPE` can be `NUMBER`, `TEXT`, or `DATETIME`.
`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_CONTAINS Returns true if X contains the regular expression pattern, otherwise returns false.
` REGEXP_CONTAINS(X, regular_expression) `
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) `
Text STARTS_WITH Returns true if X starts with text. Otherwise, returns false. Case-sensitive.
` 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.
` SUBSTR(X, start index, length) `
` TRIM(X) `
` UPPER(X)`