[Looker Studio] How to Use the MAX Function and Practical Examples | Calculated Fields
In this article, we will clearly explain how to use the MAX function in Looker Studio and provide specific examples of its application. By utilizing the functions available in Looker Studio, you can process data and visualize the information you want to see.
Although the MAX function cannot be used with metrics from GA4 (Google Analytics 4), Search Console, and Google Ads when using connectors, it can be used with certain dimensions, so please take advantage of it.
What are Calculated Fields in Looker Studio?
Calculated Fields in Looker Studio are a handy feature that allows you to create custom fields by using operators (such as addition, subtraction, multiplication, division), functions, and regular expressions based on existing items for use in reports.
Also, for basic usage of Looker Studio, please refer to the "How to Use Looker Studio" guide. Looker Studio is a very convenient tool that is free to use and allows for the creation of easy-to-understand reports by connecting to various data sources, so let's make active use of it.
What is the MAX Function?
The MAX function is used to obtain the "maximum value" of a specified numerical field. It is applied to fields containing numerical data and retrieves the highest value among all the numbers within the selected range. This function is helpful in understanding trends of specific metrics.
Syntax
The syntax of the MAX function is as follows:
MAX("number")
"Number" specifies the value for which you want to obtain the maximum value. The maximum value of this number will be obtained. You can also specify the "date" format. In that case, the most recent date will be obtained.
Conditions for Using the MAX Function
There are two conditions for using the MAX function. Before using it to obtain the maximum value, ensure that the number meets the following criteria:
It Must Be a Number (Including Dates)
The MAX function is designed to find the maximum value, so it cannot be used for dimensions that are not numerical.
It Must Not Be an Aggregated Metric
If the numerical data from the data source has already been aggregated by a connector or similar tool, the MAX function cannot be used. You can determine if a number is aggregated by checking if the default aggregation of the data source is set to automatic. The MAX function cannot be used on automatically aggregated numbers, so please be cautious.
(Quote)Looker Studio
How to Use the MAX Function
To use the MAX function, you need to create a calculated field in Looker Studio. There are two types of calculated fields: data source calculated fields and chart-specific calculated fields. This article will focus on creating a data source calculated field, but for more detailed differences between the two, please see the differences between data source calculated fields and chart-specific calculated fields.
As previously mentioned, the MAX function cannot be used with metrics from data sources such as GA4 (Google Analytics 4), Search Console, and Google Ads that utilize connectors. Therefore, for this example, we have prepared sample data in a spreadsheet containing daily customer and sales data for each store. I will use this sample data to explain.
Use case:Visualize the highest daily sales in Looker Studio.
Set the calculated fields as follows.
(Quote)Looker Studio
-
Field Name: Please enter any field name.
-
Formula: MAX(Sales)
-
Save: Once you have entered the information, click Save.
A field named Maximum Sales has now been created as shown below.
(Quote)Looker Studio
Let's add the metrics we just created to the report so they can be utilized. By doing so, you will see that the numbers are correctly reflected in the table.
(Quote)Looker Studio
How to Find the Maximum Value Without Using Calculated Fields
For relatively simple calculations like finding the maximum value, you can reflect it in your report without using calculated fields. Here are the steps to do so.
Use case:Visualize the Maximum Daily Customer Count in Looker Studio
To start, click on the mark on the left side of the metric for which you want to find the maximum value in the report.
(Quote)Looker Studio
Next, enter the name and check the "Max" option for the aggregation method.
Now the settings have been applied to the report, and the maximum number of customers is displayed. This is the method for displaying the maximum value using the MAX function. Please give it a try.
Relevant Looker Studio Official Documentation
Looker Studio Official Help : About calculated fields
Looker Studio Official Help : Function list