Looker Studio Function : ENDS_WITH

ENDS_WITH Function in Looker Studio – Practical Explanation with Examples

Category: Text Function

The ENDS_WITH function in Looker Studio is a text function used to check whether a text value ends with a specific word, character, or pattern. It returns a TRUE or FALSE result depending on the condition. This function is extremely helpful when working with structured text values like email IDs, file names, URLs, campaign names, or product codes.

In real dashboards, we often need to identify data based on suffixes. For example, checking whether an email ends with “@gmail.com”, a URL ends with “/checkout”, or a product code ends with a specific series. ENDS_WITH allows us to perform this check directly inside Looker Studio without modifying the original data source.

From a reporting perspective, this function simplifies filtering, classification, and conditional formatting. Since it works at row level and is case-insensitive, it gives consistent results across large datasets. Compared to REGEXP functions, ENDS_WITH is simpler, easier to maintain, and more readable for basic suffix-based logic.

Purpose of the ENDS_WITH Function

1. Suffix Identification

Used to check if a text value ends with a particular keyword or character sequence.

2. Data Segmentation

Helps segment data based on ending patterns like domains, extensions, or codes.

3. Conditional Logic Support

Works perfectly with IF or CASE statements for rule-based classification.

4. Filtering & Validation

Useful for validating data formats such as email domains or URL endings.

Type of Calculation & Practical Use Cases

1. Boolean Calculation

ENDS_WITH returns TRUE or FALSE, making it suitable for logical conditions.

2. Calculated Dimensions

Commonly used inside calculated dimensions for grouping or tagging data.

3. Dashboard Filters

Allows filtering records based on specific text endings.

4. Data Quality Checks

Helps identify invalid or unexpected text formats.


ENDS_WITH(text, suffix)

ENDS_WITH Function – Parameters Table

ParameterTypeDescription
textTextThe main text value to be checked
suffixTextThe text or characters to match at the end

How Does the ENDS_WITH Function Work?

The ENDS_WITH function checks the ending portion of the given text value and compares it with the specified suffix. If the text ends exactly with the given suffix, the function returns TRUE; otherwise, it returns FALSE.

The comparison is case-insensitive, so “.PDF” and “.pdf” are treated the same. The function evaluates each row independently, making it ideal for large datasets. If the text value is NULL or empty, the function typically returns FALSE, so handling such cases improves accuracy.


When Should You Use ENDS_WITH Function?
  1. When validating email domains or file extensions

  2. When classifying data based on suffix patterns

  3. When filtering URLs or paths ending with specific values

  4. When avoiding complex REGEXP expressions

  5. When working with structured text fields

Examples of ENDS_WITH Function

Example 1: Identify Gmail Users
ENDS_WITH(Email_ID, "@gmail.com")

Returns TRUE for Gmail email addresses.


Example 2: Check PDF Files
ENDS_WITH(File_Name, ".pdf")

Used to identify PDF documents.


Example 3: Combine with IF Condition
IF(ENDS_WITH(URL, "/checkout"), "Checkout Page", "Other Page")

Tips & Best Practices

  • Use ENDS_WITH instead of REGEXP for simple suffix checks

  • Always test with sample data in tables

  • Handle NULL values to avoid incorrect results

  • Keep suffix values clean and exact

  • Combine with CASE for multiple suffix checks

1. Is ENDS_WITH case-sensitive?

No, it is case-insensitive.

2. Does ENDS_WITH return text?

No, it returns only TRUE or FALSE.

3. Can it be used in metrics?

It is mainly used in calculated dimensions and logical expressions.

4. What happens if text value is NULL?

The function usually returns FALSE.

5. Can ENDS_WITH replace REGEXP_MATCH?

For simple suffix matching, yes. REGEXP is better for complex patterns.