Tutorial

From Beginner to Pro: Looker Studio Formulas and Functions Explained

Table of content

Imagine cutting your reporting time in half while uncovering insights your spreadsheets miss. That’s the power of Looker Studio—Google’s data visualization tool adopted by over 6000 companies worldwide as of 2025.

Many Looker Studio users fall into a common trap: they master drag-and-drop visualizations but stop short of learning formulas - the very feature that turns static reports into dynamic analysis engines. These formulas are your secret weapon to:

  • Fix messy data

  • Answer urgent questions

  • Automate what you’d normally do in Excel

A McKinsey study found data-driven organizations are 23x more likely to acquire customers (Source). Looker Studio formulas put that power in your hands—no coding needed.

Understanding Looker Studio Formulas: The Building Blocks of Smart Reporting

What Are Calculated Fields?

Looker Studio's calculated fields transform raw data into actionable business insights through custom formulas. These powerful tools:

  • Create new metrics from existing data (e.g., conversion rates)

  • Clean and standardize data (e.g., formatting phone numbers)

  • Enable advanced analysis without altering source data

Key Data Components in Looker Studio

Component

Description

Example

Dimensions

Qualitative attributes for grouping

Region, Product Category

Metrics

Quantitative values for measurement

Revenue, Units Sold

Calculated Fields

Custom formulas combining both

Profit Margin, Conversion Rate

Practical Applications for Business Users

  • Marketing Teams:

    • Create custom conversion metrics

    • Examples

      • ROI = (Revenue - Ad Spend) / Ad Spend

      • Conversion Rate = (Conversions / Sessions) * 100

  • Sales Operations:

    • Compute pipeline velocity

    • Build territory performance dashboards

    • Examples

      • Pipeline Velocity = (Deal Amount Win Rate) / Sales Cycle Length

      • Average Deal Size = SUM(Opportunity Amount) / COUNT(Opportunities) Territory

      • Performance = (Actual Sales / Quota) 100

  • Executives:

    • Develop company-wide KPIs

    • Create normalized performance metrics

    • Examples

      • YoY Growth = (Current Year Revenue - Prior Year Revenue) / Prior Year Revenue

      • EBITDA Margin = (EBITDA / Total Revenue) * 100

      • Customer Lifetime Value = Average Order Value Purchase Frequency Customer Lifespan

When to Use Formulas

  • To combine multiple data points

  • When source data needs transformation

  • For creating standardized metrics across reports

  • When working with blended data sources

Now that your calculated field is saved in the data source, you can use it in any report connected to this dataset. Simply edit your charts and add the new field under Metrics or Dimensions as needed.

Guide to Looker Studio Formula Syntax

Mastering Looker Studio's formula syntax transforms raw data into actionable insights. This section breaks down the essential components for creating reliable, high-performance calculations in your data visualizations.

Core Syntax Components

Looker Studio supports three operator classes for calculated fields:

Arithmetic Operators (for mathematical calculations)

  • Addition (+), Subtraction (-)

  • Multiplication (*), Division (/)

  • Modulus (%), Exponentiation (^)

Comparison Operators (for conditional functions)

  • Equal to (=), Not equal to (!=)

  • Greater than (>), Less than (<)

  • BETWEEN (for range checks)

Logical Operators (for branching logic)

  • AND, OR, NOT

  • IN (for multiple value checks)

  • IS NULL/IS NOT NULL (for missing data)

How to Create Calculated Fields in Looker Studio

Calculated fields transform raw data into actionable insights. This section provides a step-by-step guide to creating them at both the data source and chart levels, along with best practices for implementation.

Creating Calculated Fields in Data Source

  1. Navigate to "Resource" > "Manage added data sources"

  2. If there are multiple data sources in the report, then select the data source in which you want to add a calculated field and click on the "Edit" icon

  3. Click on the "Add a Field" button, and select the "Add Calculated Field" from the dropdown

  4. Name the Field and enter the formula using Looker Studio's function syntax in the formula field. For example: Profit Margin = ((Revenue - Cost) / Revenue) * 100

  5. Verify the formula and click "Save" and then "Done"

With your calculated field now established at the data source level, this metric becomes automatically available across all existing and future reports utilizing this dataset. To implement:

  • Select the chart which you want to edit and add the Calculated Field in, and add the field in Metric/Dimension (as per your need)

  • Once you add the field in the metrics section, the chart will automatically update, reflecting the changes immediately.

Creating Calculated Fields in Specific Charts

  1. Select the chart where you want to add the calculated field and click on the pencil icon

  2. In the properties panel, locate "Dimensions" or "Metrics"

  3. Click "Add a field" and select "Add calculated field" from the dropdown

  4. Name the Field and enter your formula using Looker Studio's function syntax in the formula field for example: CTR (Click-Through Rate) = (Clicks / Impressions) * 100

  5. Verify the formula and click "Save" and then "Done"

This calculated field has been successfully created for exclusive use within this specific visualization. To implement it, simply add the field in the chart's setup panel, just as you would with any standard field.

When to Use Chart-Level vs. Data Source Fields:

Data Source Fields

Chart-Level Fields

Reusable across multiple reports

Limited to a single chart

Ideal for standardized metrics

Best for ad-hoc analysis

Require data source access

Can be created by any editor

Technical Note: While chart-level fields offer flexibility, they may impact report performance when overused in complex dashboards. Evaluate moving to data source calculations when metrics demonstrate long-term value.

Looker Studio Function Reference

Aggregation functions

Function

Description

Syntax

Data Type

Use Case Example

COUNT

Counts all non-null values

COUNT(X)

Any

COUNT(Order_ID) - Total orders placed

COUNT_DISTINCT

Counts unique non-null values

COUNT_DISTINCT(X)

Any

COUNT_DISTINCT(Customer_ID) - Unique customers

MAX

Returns maximum value

MAX(X)

Numeric/Date

MAX(Revenue) - Highest sale amount

MEDIAN

Calculates median (50th percentile)

MEDIAN(X)

Numeric

MEDIAN(Salary) - Typical employee salary

MIN

Returns minimum value

MIN(X)

Numeric/Date

MIN(Temperature) - Lowest recorded value

PERCENTILE

Calculates specified percentile

PERCENTILE(X, N)

Numeric

PERCENTILE(Revenue, 90) - Top 10% performance

STDDEV

Measures standard deviation

STDDEV(X)

Numeric

STDDEV(Monthly_Sales) - Sales volatility

SUM

Calculates total of all values

SUM(X)

Numeric

SUM(Profit) - Quarterly profit total

VARIANCE

Computes statistical variance

VARIANCE(X)

Numeric

VARIANCE(Test_Scores) - Score distribution

Arithmetic functions

Function

Description

Syntax

Parameters

Use Case Example

ACOS

Returns arc cosine in radians

ACOS(X)

X: Number between -1 and 1

Calculate angles in engineering models

ASIN

Returns arc sine in radians

ASIN(X)

X: Number between -1 and 1

Signal processing calculations

ATAN

Returns arc tangent in radians

ATAN(X)

X: Any number

Slope angle calculations

CEIL

Rounds up to nearest integer

CEIL(X)

X: Number

CEIL(3.2) = 4 (for inventory ordering)

COS

Returns cosine of angle

COS(X)

X: Angle in radians

Waveform analysis

FLOOR

Rounds down to nearest integer

FLOOR(X)

X: Number

FLOOR(2.9) = 2 (for conservative estimates)

LOG

Natural logarithm (base e)

LOG(X)

X: Positive number

Growth rate calculations

LOG10

Base-10 logarithm

LOG10(X)

X: Positive number

pH/decibel scaling

NARY_MAX

Returns largest value

NARY_MAX(X,Y,...)

2+ numbers

Find highest score across multiple tests

NARY_MIN

Returns smallest value

NARY_MIN(X,Y,...)

2+ numbers

Identify minimum temperature across sensors

POWER

Raises to specified power

POWER(X,Y)

X: Base, Y: Exponent

Compound interest calculations

ROUND

Rounds to decimal places

ROUND(X,Y)

X: Number, Y: Decimals

ROUND(3.14159,2) = 3.14 (financial reporting)

SIN

Returns sine of angle

SIN(X)

X: Angle in radians

Tide height predictions

SQRT

Square root

SQRT(X)

X: Non-negative number

Standard deviation calculations

TAN

Returns tangent of angle

TAN(X)

X: Angle in radians

Roof pitch calculations

Conditional functions

Function

Description

Syntax

Application

Output

Use Case Example

CASE

Evaluates multiple conditions sequentially

CASE WHEN cond1 THEN val1 WHEN cond2 THEN val2 ELSE default END

Multi-branch logic

Any data type

Tiered customer segmentation: CASE WHEN CLV>1000 THEN 'VIP' WHEN CLV>500 THEN 'Standard' ELSE 'New' END

CASE (Simple)

Simplified single-expression comparison

CASE expr WHEN val1 THEN res1 WHEN val2 THEN res2 ELSE default END

Single-variable matching

Any data type

Region grouping: CASE Region WHEN 'West' THEN 1 WHEN 'East' THEN 2 ELSE 3 END

COALESCE

Returns first non-null value

COALESCE(val1, val2, ...)

Handling missing data

First non-null input

Fallback values: COALESCE(Discount, 0)

IF

Basic conditional

IF(cond, true_val, false_val)

Binary decisions

Specified types

Performance flag: IF(ROI>1, 'Profitable', 'Loss')

IFNULL

Returns alternative if null

IFNULL(expr, alt_val)

Null handling

expr or alt_val

Default metrics: IFNULL(Engagement_Score, 100)

NULLIF

Returns null if equal

NULLIF(expr1, expr2)

Exception handling

expr1 or NULL

Error filtering: NULLIF(Score, -1)

Date functions

Function

Description

Syntax

Category

Use Case Example

CURRENT_DATE

Returns current date

CURRENT_DATE()

Current Date

CURRENT_DATE() as report refresh indicator

CURRENT_DATETIME

Returns current datetime

CURRENT_DATETIME()

Current Date

Timestamp for data freshness checks

DATE

Creates date from parts

DATE(year,month,day)

Date Construction

DATE(2023,12,25) for holiday analysis

DATE_DIFF

Date difference in units

DATE_DIFF(date1,date2,unit)

Date Calculation

DATE_DIFF(OrderDate,ShipDate,'DAY') for delivery time

DATE_FROM_UNIX_DATE

Converts Unix days to date

DATE_FROM_UNIX_DATE(days)

Conversion

Convert analytics timestamps

DATETIME

Creates datetime from parts

DATETIME(year,month,day,hour,minute,second)

DateTime Construction

Event timestamp creation

DATETIME_ADD

Adds interval to datetime

DATETIME_ADD(datetime,interval)

DateTime Calculation

DATETIME_ADD(OrderTime, INTERVAL 2 HOUR) for SLA deadlines

DATETIME_DIFF

DateTime difference

DATETIME_DIFF(datetime1,datetime2,unit)

DateTime Calculation

DATETIME_DIFF(StartTime,EndTime,'HOUR')

DATETIME_SUB

Subtracts interval

DATETIME_SUB(datetime,interval)

DateTime Calculation

DATETIME_SUB(Now(), INTERVAL 30 MINUTE)

DATETIME_TRUNC

Truncates to unit

DATETIME_TRUNC(datetime,unit)

DateTime Conversion

DATETIME_TRUNC(LogTime,'HOUR') for hourly aggregates

DAY

Extracts day

DAY(date)

Date Part

DAY(BirthDate) for birthday campaigns

EXTRACT

Extracts date part

EXTRACT(part FROM date)

Date Part

EXTRACT(WEEK FROM SaleDate)

FORMAT_DATETIME

Formats datetime

FORMAT_DATETIME(format_string,datetime)

Formatting

FORMAT_DATETIME('%F',OrderDate) for ISO format

HOUR

Extracts hour

HOUR(datetime)

Time Part

HOUR(LoginTime) for peak usage analysis

MINUTE

Extracts minute

MINUTE(datetime)

Time Part

MINUTE(Duration) for call center metrics

MONTH

Extracts month

MONTH(date)

Date Part

MONTH(InvoiceDate) for seasonal trends

PARSE_DATE

Converts string to date

PARSE_DATE(format,string)

Conversion

PARSE_DATE('%m/%d/%Y',input_string)

PARSE_DATETIME

Converts string to datetime

PARSE_DATETIME(format,string)

Conversion

Parse API response timestamps

QUARTER

Extracts quarter

QUARTER(date)

Date Part

Fiscal quarter reporting

SECOND

Extracts second

SECOND(datetime)

Time Part

Process timing analysis

TODATE

Converts to date

TODATE(value,format)

Conversion

TODATE(LastModified,'YYYYMMDD')

TODAY

Current date

TODAY()

Current Date

Age calculation: DATE_DIFF(TODAY(),BirthDate,'YEAR')

UNIX_DATE

Converts to Unix days

UNIX_DATE(date)

Conversion

System integration timestamps

WEEK

Extracts week number

WEEK(date)

Date Part

Weekly performance reporting

WEEKDAY

Day of week (1-7)

WEEKDAY(date)

Date Part

CASE WEEKDAY(date) WHEN 1 THEN 'Sun'...END

YEAR

Extracts year

YEAR(date)

Date Part

Annual comparison calculations

YEARWEEK

Year+week number

YEARWEEK(date)

Date Part

Weekly trends across years

Geo functions

Function

Description

Syntax

Input

Output

Visualization

Use Case Example

TOCITY

Converts to city name

TOCITY(location)

Coordinates/IP/Address

City name

Point maps

Customer location mapping: TOCITY(Customer_IP)

TOCONTINENT

Converts to continent

TOCONTINENT(location)

Coordinates/IP/Address

Continent name

Regional maps

Global traffic analysis: TOCONTINENT(Server_Location)

TOCOUNTRY

Converts to country

TOCOUNTRY(location)

Coordinates/IP/Address

Country name

Filled maps

International sales: TOCOUNTRY(Shipping_Address)

TOREGION

Converts to region/state

TOREGION(location)

Coordinates/IP/Address

Region name

Bubble maps

Regional performance: TOREGION(Store_Location)

TOSUBCONTINENT

Converts to subcontinent

TOSUBCONTINENT(location)

Coordinates/IP/Address

Subcontinent name

Heatmaps

APAC vs EMEA comparison: TOSUBCONTINENT(Office_Location)

Miscellaneous functions

Function

Description

Syntax

Output

Use Case Example

CAST

Converts data types

CAST(expression AS type)

Specified type

CAST(OrderID AS STRING) for joining with text fields

HYPERLINK

Creates clickable links

HYPERLINK(url, link_label)

Interactive link

HYPERLINK(CONCAT("https://track.com/order=",OrderID), "Track Package")

IMAGE

Embeds image URLs

IMAGE(image_url, alt_text)

Visual element

IMAGE(Product_Photo_URL, Product_Name) for catalogs

NATIVE_DIMENSION

References native dimensions

NATIVE_DIMENSION(field_name)

Original field value

NATIVE_DIMENSION(Campaign_ID) when blending data sources

Text functions

Function

Description

Syntax

Use Case Example

CONCAT

Combines multiple strings

CONCAT(string1, string2, ...)

CONCAT(FirstName, " ", LastName) for full names

CONTAINS_TEXT

Checks for substring

CONTAINS_TEXT(field, "search")

CONTAINS_TEXT(Feedback, "excellent") for sentiment tagging

ENDS_WITH

Checks string ending

ENDS_WITH(field, "suffix")

ENDS_WITH(Email, ".edu") for academic users

LEFT_TEXT

Extracts leftmost characters

LEFT_TEXT(field, length)

LEFT_TEXT(OrderID, 3) for prefix analysis

LENGTH

Returns character count

LENGTH(field)

LENGTH(Comments) for response quality scoring

LOWER

Converts to lowercase

LOWER(field)

LOWER(ProductName) for case-insensitive matching

REGEXP_CONTAINS

Pattern matching

REGEXP_CONTAINS(field, regex)

REGEXP_CONTAINS(URL, r'\/products\/') for product page hits

REGEXP_EXTRACT

Extracts pattern matches

REGEXP_EXTRACT(field, regex)

REGEXP_EXTRACT(Log, r'ID:(\d+)') for ID extraction

REGEXP_MATCH

Full string pattern match

REGEXP_MATCH(field, regex)

REGEXP_MATCH(Phone, r'^\d{3}-\d{3}-\d{4}$') for format validation

REGEXP_REPLACE

Pattern-based replacement

REGEXP_REPLACE(field, regex, replacement)

REGEXP_REPLACE(Notes, r'\d', 'X') for number redaction

REPLACE

Simple string replacement

REPLACE(field, old, new)

REPLACE(Status, "OLD", "NEW") for value standardization

RIGHT_TEXT

Extracts rightmost characters

RIGHT_TEXT(field, length)

RIGHT_TEXT(TransactionID, 4) for last digits

STARTS_WITH

Checks string beginning

STARTS_WITH(field, "prefix")

STARTS_WITH(SKU, "PRO-") for product identification

SUBSTR

Extracts substring

SUBSTR(field, start, length)

SUBSTR(Timestamp, 6, 2) for month extraction

TRIM

Removes whitespace

TRIM(field)

TRIM(CustomerName) for clean data processing

UPPER

Converts to uppercase

UPPER(field)

UPPER(CountryCode) for standardized codes

Conclusion

Looker Studio formulas and functions unlock powerful insights, helping you turn raw data into clear, actionable reports. From calculated fields to aggregation functions, mastering these tools makes your reports more dynamic and insightful.

But as your datasets grow, things can get tricky. Slow performance, messy data types, or incorrect timezones can throw off your analysis. Fine-tuning chart-level calculated fields, cleaning up string data, and using the right conditional functions can make a huge difference.

That’s where ReportDash comes in. By streamlining blended data, optimizing custom metrics, and simplifying complex data models, it takes the hassle out of reporting—so you can focus on insights, not manual fixes.

Ready to make reporting effortless? Try ReportDash today and take your Looker Studio experience to the next level!