University > Looker Studio course > SUM function: How to use & example

SUM function: How to use & example

Discover how to use the SUM function in Looker Studio to add numerical values. Learn its syntax, best practices, and real-world applications.

Formulas

The SUM function is one of the most essential and widely used aggregation tools in Looker Studio (formerly Google Data Studio). It allows you to quickly calculate totals across rows or columns in your data set, whether you’re summing revenue, counting customers, or analyzing performance metrics. This function is a cornerstone of any data aggregation process, helping you transform raw numbers into meaningful, actionable insights.

What is the SUM Function

The SUM function adds up all the numeric values within a chosen field or expression.
In Looker Studio, it helps you total metrics across your data source or calculated fields to build metrics such as total sales, total revenue, or total engagement.

Syntax:

SUM(field_name)

  • field_name must be a numeric field.
  • It cannot be an already aggregated field or the result of another aggregation function.
  • You can sum only one field at a time.

How it works

The SUM function operates by scanning through all rows in the selected field and adding the values together.
You can apply it directly to an existing numeric field (for example, Sales, Revenue, Clicks), or inside a calculated field to create new metrics such as total revenue per campaign or total spend per channel.

If you want to focus on a subset of your data, such as sales from a single region or a specific time period, you can use filters in Looker Studio.
Go to File → Report settings or Page → Current page settings, and apply a filter to sum only the relevant data.
Created filters can be saved and reused across multiple charts or pages.

SUM examples

Example 1: Total Sales per Quarter

MonthNumber of SalesJanuary500February650March700

To find the total sales for the quarter:

SUM(Number of Sales)

Result: 1850

Example 2: Total Expenditure per Year

If you have a column called Expenditure, simply use:

SUM(Expenditure)

This gives you the total amount spent over your selected time range, perfect for financial summaries or budget tracking.

Example 3: Revenue by Customer Type

Imagine an e-commerce dataset with fields such as Order ID, Order Date, Customer Type, and Order Total.
You want to visualize monthly total revenue for new versus returning customers.

Steps:

  1. Create a calculated field:

SUM(Order Total)

  1. Add month and year dimensions extracted from Order Date.
  2. Create a parameter for Customer Type (New / Returning).
  3. Filter using Customer Type = $CustomerType.
  4. Visualize revenue by month and customer type.

You now have an interactive chart showing monthly totals by segment, powered by the SUM function.

Key rules and limitations

  • Works only with numeric data.
  • Cannot sum aggregated or nested fields.
  • Avoid NULL or non-numeric entries, as they can break your calculation.
  • Use filters to control which rows are included in your sum.

Tips for using SUM effectively

  • Validate your data before applying aggregations to avoid skewed results.
  • Combine SUM with parameters and filters for interactive dashboards.
  • Use SUM inside calculated fields to create custom KPIs such as Total Profit, Total Clicks, or Total Leads.
  • SUM can be combined with functions such as CASE, IF, or date extraction (MONTH, YEAR) for dynamic insights.

In summary

The SUM function is one of the simplest yet most powerful tools in Looker Studio. It allows marketers, analysts, and business owners to aggregate large datasets effortlessly and uncover key performance insights. By mastering SUM, along with filters and calculated fields, you can build dashboards that summarize complex data in a clear, actionable way.

More Functions to explore in Looker Studio

  • AVG – Average Function: How to use and examples
  • COUNT_DISTINCT – Counting unique values
  • MAX / MIN – Find maximum and minimum values
  • MEDIAN – Calculate the middle value of a dataset
  • TOCOUNTRY – Convert locations to country names