In Looker Studio, custom metrics are a powerful tool that allows you to create tailored insights from your data. By combining different fields and calculations, you can create unique metrics that provide a deeper understanding of your business.
Custom metrics can be created using a variety of functions, including arithmetic operations, conditional statements, and even data aggregation. This flexibility makes it easy to craft metrics that meet specific needs.
For example, a company might create a custom metric to track the average order value over the past 30 days. This metric would be calculated by dividing the total revenue by the number of orders, and then applying a filter to only include data from the past month.
Creating Custom Metrics
To create a custom metric in Looker Studio, you need to plan your calculated field first, identifying the KPIs that aren't directly available in a single data source.
Start by defining which data sources, dimensions, metrics, and functions you'll need to create those. This step helps you understand what you want to achieve with your calculated field.
Decide whether to create a Data Source or Chart Level Calculated Field, as this flexibility allows you to create calculated fields that are as broad or as specific as you need them to be.
To add a new field to your data source or chart, click on the "Add field" button and choose the type of field you want to create.
In the formula field, define how your existing dimensions or metrics should be manipulated using arithmetic functions, such as adding, subtracting, multiplying, or dividing two metrics.
You can also use string functions, such as CONCAT, to combine text data. Make sure to check the formula checker for errors before creating the new field.
To apply the new field to your visualization, click Save and it will appear alongside the standard metrics and dimensions of the data source.
The data type of your calculated field is also important, as arithmetic operations like SUM and COUNT can only be used with numeric data, while string functions like CONCAT can only be used with text data.
Formula and Function Fundamentals
Formulas in Looker Studio are written using specific rules, known as syntax, to ensure accurate results. Understanding these rules is crucial to creating correct formulas.
The syntax includes operators, functions, conditionals, and literals. Operators are used to perform various operations, such as arithmetic, comparison, and logical operations. Functions, on the other hand, are used to perform specific tasks, like counting distinct values or aggregating data.
Here are some common functions and their syntax:
These functions can be used to create calculated fields, such as counting unique keywords or aggregating data.
Formula Syntax
Formulas in Looker Studio are written using specific rules, known as syntax. This syntax is crucial to ensure accurate results.
Looker Studio supports a variety of operators in its formulas, including arithmetic, comparison, and logical operators. These operators can be used to perform calculations, compare values, and evaluate conditions.
Functions in Looker Studio have a specific syntax that defines how to use them, including the parameters needed. For example, the ROUND function requires two parameters: the value to be rounded and the number of precision digits.
Conditionals in Looker Studio are used to perform different calculations based on certain conditions. The CASEWHENTHENELSEEND statement is used to evaluate conditions and return different results.
Literals in Looker Studio represent constant values written directly into formulas. They can be numbers, strings, or dates. For example, the literal "2022-01-01" represents a specific date.
Here are some arithmetic functions in Looker Studio:
Some common conditional functions in Looker Studio include IF, IFNULL, NULLIF, COALESCE, and CASE. These functions can be used to evaluate conditions and return different results.
Aggregation
Aggregation is a powerful tool in data analysis that allows you to summarize and group your data, providing insights that might not be apparent at first glance.
You can use aggregation functions to return the sum of all values, such as SUM(X) which returns the sum of all values of X.
The AVG function returns the average of all values, for example AVG(X) which returns the average of all values of X.
The MAX function returns the maximum value of X, while the MIN function returns the minimum value of X.
Some commonly used aggregation functions include SUM, AVG, MAX, MIN, COUNT, and COUNT_DISTINCT.
Here's a breakdown of what each of these functions does:
These aggregation functions can help you get analysis-ready data to build insightful reports.
Using Custom Metrics
Using custom metrics in Looker Studio is a game-changer for businesses. You can create formulas that perform actions on one or multiple fields in a data source, allowing you to apply calculations and other functions to your data to create new metrics and dimensions.
Calculated fields can be used to calculate conversion rates, determine revenue per visit, extract the month from a date field, and concatenate first and last name into a full name field. For example, you could use a calculated field to calculate conversion rate by dividing conversions by visits.
To create a formula in a data source's calculated field, you can follow these steps: click a data source where you want to add the formula, click the Add a field button, select Add calculated field, enter Field Name and Formula, and click Save. You can also reference an existing field by typing its name directly in the formula field or by clicking it from the Available Fields list.
Here are some examples of Looker Studio functions you can use for your reports:
- Conditional Case: used to add a branching logic to your data.
- Conditional If: similar to the above mentioned function, adds a branching logic to your data.
- Aggregation: used for numeric data, to add, subtract or count the values.
- Date: used to manipulate the dates collected from data sources.
- Text: used to manipulate textual data.
Remember, the true test of an impactful calculated field is how clearly it communicates data insights. Use clear, descriptive names for your metrics, set appropriate number formatting and units, and label charts and visuals clearly.
Using in Chart-Specific
You can create a formula in a chart-specific calculated field by clicking on the chart where you want to apply the formula. Then, in the Setup tab, click Add dimension or Add metric, depending on what you want to create.
To create a formula in a chart-specific calculated field, enter a Name and Formula for the new field. For example, you can add a new dimension named Category and use a formula with a function: UPPER(ProductCategory).
You can see the new field in the chart after clicking Apply. This is a great way to add a calculated field to a specific chart without affecting your original data source.
Here's a step-by-step guide to creating a chart-specific calculated field:
1. Open your report in edit mode.
2. Click a chart where you want to apply the formula.
3. In the Setup tab, click Add dimension or Add metric, depending on what you want to create.
4. Enter a Name and Formula for the new field.
5. Click Apply to see the new field in the chart.
This is a powerful way to add custom metrics to your charts without affecting your original data source.
Efficient AI assistant
As an efficient AI assistant, I can help you work with custom metrics by manipulating text data using string functions in Looker Studio.
One key function is SUBSTR, which returns a text that is a substring of X, starting at a specified index and being a certain number of characters long.
Using string functions can save you a lot of time and effort when cleaning and formatting your data.
For instance, the TRIM function returns X with leading and trailing spaces removed, which can be particularly useful when working with data that has inconsistent formatting.
You can also use the LENGTH function to return the number of characters in a given text, which can be helpful when working with data that has varying lengths.
Here are some common string functions in Looker Studio, along with their syntax and what they do:
By mastering these string functions, you'll be able to efficiently work with custom metrics and get the insights you need to make informed decisions.
Custom Metric Properties
Custom Metric Properties are a powerful tool in Looker Studio, allowing you to tailor the data displayed in your charts.
You can include "optional" metrics, which won't display in the default version of the chart, but the viewer can toggle them to be included.
To add an optional metric, you'll need to click on the chart and navigate to the Setup section of the Properties tab. This is where you can specify the additional metrics you want to make available for viewers to toggle on or off.
Custom Metric Best Practices
Derive new metrics not available in the raw data by using calculated fields to generate key metrics and dimensions that aren't already present in the source data.
Calculated fields can be used to transform existing fields for analysis, such as extracting the month or year from a date field to analyze trends over time. This can be especially useful for deeper analysis.
To create custom metrics, consider the following best practices:
- Derive new metrics not available in the raw data
- Flexibly transform existing fields for analysis
- Create comparative metrics for deeper analysis
- Enrich geographic data for visualization
- Manipulate text strings and data formats
By following these best practices, you can create custom metrics that are tailored to your specific needs and extract more value from your data.
Why to Use?
Calculated fields are an invaluable tool for creating custom metrics tailored to your specific needs, allowing you to extract more value from your data.
Deriving new metrics not available in the raw data is a key benefit of calculated fields. For example, you may want to calculate conversion rate, average revenue per user, or churn rate to gain deeper insights into your business.
Calculated fields let you generate key metrics and dimensions that aren't already present in the source data. This is particularly useful when you need to analyze trends over time or compare segments of a dataset.
You can use calculated fields to blend data from multiple sources into unified metrics. This allows you to connect insights from your CRM, web analytics, financial data, and more.
Creating comparative metrics for deeper analysis is another advantage of calculated fields. With them, you can easily create metrics to compare segments of a dataset, such as conversion rate between different customer segments.
Here are some specific use cases for calculated fields:
- Derive new metrics not available in the raw data (e.g. conversion rate, average revenue per user)
- Flexibly transform existing fields for analysis (e.g. extracting the month or year from a date field)
- Blend data from multiple sources (e.g. CRM, web analytics, financial data)
- Create comparative metrics for deeper analysis (e.g. conversion rate between customer segments)
- Enrich geographic data for visualization (e.g. combining geographic data with other metrics)
- Manipulate text strings and data formats (e.g. cleaning up inconsistent formats, extracting parts of text strings)
Optimizing Performance
Optimizing Performance is crucial to creating dashboards that are both informative and efficient. Simplify your formulas by avoiding unnecessary nesting and complexity.
A good example of this is in Looker Studio, where complex calculated fields can impact performance when dealing with large volumes of data. This is why it's essential to limit filters in complex calculations, as adding many filters can slow things down.
You can also granularize large formulas by breaking them into smaller, reusable calculated fields. This will not only improve performance but also make your formulas easier to manage.
Here are some specific tips to keep in mind:
- Simplify formulas: Avoid unneeded nesting and complexity.
- Limit filters: Adding many filters to a complex calculation may slow things down.
- Granularize large formulas: Break into smaller reusable calculated fields.
Real-life Use Cases Are Numerous
Looker Studio is a versatile tool that can adapt to any use case companies encounter on a daily basis. Custom Conversion Rate is a great example of this, where standard metrics don't provide the required insights, and you need to look for alternatives.
You can easily calculate a more insightful metric like Conversion Per Impression (CPI) by dividing the number of conversions by the number of impressions using a calculated field. This can be done simply by dividing the number of conversions by the number of impressions.
Mobile Traffic Share Development Comparison Between Countries is another example of how Looker Studio can help. You can compare segments with only one chart by creating a calculated field that divides the number of mobile visits by the total number of visits for each country.
Cleaning URLs is also a great use case for Looker Studio, where you can remove tracking parameters or session IDs to create clean, readable URLs. This can greatly improve the clarity and accuracy of your reports.
Grouping content is another powerful feature of Looker Studio, where you can create a category field using a calculated field to analyze the performance of your blog posts based on their categories. You can extract the category from the URL or the post title to group your posts into categories.
Custom page grouping is also a useful feature, where you can add similar pages under one group and analyze their traffic as a single dimension in your report. For example, you can add all the blog pages like a Blog group using a CASE WHEN calculated field.
You can use custom grouping to identify the performance of paid and organic channels using the CASE WHEN calculated field. This can help you evaluate marketing performance and identify the channels that are driving the most conversions.
The checkout funnel is another important use case for Looker Studio, where you can identify how many customers actually purchase the items added to the cart using the CASE WHEN calculated field. This can help you understand customer behavior and the stage at which they drop off.
Advanced Custom Metrics
Advanced Custom Metrics allow you to dig deeper into your data and gain more insights.
You can segment your customers using the CASE function, which is particularly useful for analyzing purchase history.
A CASE statement can help you achieve this by categorizing customers based on their purchase history. This can be a game-changer for understanding customer behavior and preferences.
If you have a dataset with URLs in various formats, you can standardize them to start with 'www.' using the REGEXP_REPLACE function.
This ensures all URLs in your dataset follow a consistent format, making it easier to analyze and compare data.
Here are some examples of advanced formulas and functions in Looker Studio:
- Segmenting customers using the CASE function
- Standardizing data with REGEXP_REPLACE function
Custom Metric Management
Custom Metric Management is a crucial aspect of Looker Studio. You can create custom metrics from scratch using the "Create Metric" button.
With custom metrics, you can define your own calculation logic, which is especially useful when you need to combine data from multiple sources. This can be done by using the "Add Field" button to select the fields you want to include in your calculation.
Custom metrics can be used to calculate complex business metrics, such as revenue growth or customer churn. You can also use them to create metrics that are specific to your company's needs.
To manage custom metrics effectively, it's essential to give them descriptive names and tags. This makes it easier to find and understand the metrics later on.
Custom Metric Guides
You can use calculated fields in Looker Studio to create custom metrics that provide deeper insights into your data. Calculated fields can be created either in the data source or directly in charts.
To create a new calculated field, follow Step 1 in the guide, which involves creating a new field.
Calculated fields can be used in any report that uses at least one data source. Once connected, you can use the calculated fields to add different formulas.
Using custom page grouping is a great way to analyze website traffic data. For example, you can add all the blog pages like a Blog group using the CASE WHEN formula.
To evaluate marketing performance, you can use the CASE WHEN calculated field to identify the performance of paid and organic channels. This is particularly useful for e-commerce sites, where it's essential to check customer behavior and the stage at which they drop off.
The checkout funnel is a great example of a calculated field that can be created using the CASE WHEN formula. You can identify how many customers actually purchase the items added to the cart.
To identify the performance of your branded keywords, you can use the calculated fields to determine how your users find you on search engines. This can be particularly useful for SEO, where you need to analyze your keyword's ranking distribution.
You can use the CASE WHEN formula to find out which of the keywords are ranked in the first top 3 positions on search engines. This can be done by creating a calculated field that checks the average position of your keywords.
Custom Metric Reporting
Custom Metric Reporting is a powerful feature in Looker Studio that allows you to create custom metrics tailored to your business needs. You can use calculated fields to perform actions on one or multiple fields in a data source, creating new metrics and dimensions.
With calculated fields, you can calculate conversion rates by dividing conversions by visits, determine revenue per visit by dividing revenue by visits, extract the month from a date field, and concatenate first and last name into a full name field. This empowers you to ask deeper questions of your data and get to the heart of key business questions.
You can use functions like MAX and MIN to return the maximum and minimum values, or the UPPER function to convert a text to uppercase. For example, you can use the AVG function to display the average order value (AOV) of your online sales in a scorecard.
Calculated fields can be used to create complex visualizations that are easy to understand and display quickly. This is an important condition for maintaining attention levels and winning the appreciation of your users.
Here are some examples of custom metric reporting use cases:
- Custom Conversion Rate: Calculate the conversion rate by dividing conversions by impressions.
- Mobile Traffic Share Development Comparison Between Countries: Create a calculated field that divides the number of mobile visits by the total number of visits for each country.
- Funnel Drop-Off Rate Calculation: Calculate the conversion drop-off rate for all your funnel steps, providing valuable insights into your conversion process.
- Cleaning URLs: Use calculated fields to remove tracking parameters or session IDs from URLs, creating clean and readable URLs.
- Grouping Content: Create a category field using a calculated field to group your posts into categories and analyze their performance.
By using calculated fields and functions in Looker Studio, you can create custom metrics that provide actionable insights into your business.
Sources
- https://www.analyticsmania.com/post/looker-studio-tutorial-for-google-analytics-4/
- https://www.catchr.io/university/looker-studio-course/how-to-use-looker-studio-calculated-field-a-complete-overview
- https://blog.coupler.io/looker-studio-formulas-and-functions/
- https://www.databloo.com/blog/google-looker-studio-calculated-fields/
- https://measureschool.com/data-studio-functions/
Featured Images: pexels.com