Understanding and Using the TOCOUNTRY Function in Looker Studio for Enhanced Data Reporting

 Understanding and Using the TOCOUNTRY Function in Looker Studio for Enhanced Data Reporting

Google Data Studio comprises an extensive assortment of functions, one of which is the TOCOUNTRY function. This function is instrumental in identifying the complete name of the country from the corresponding country code or geolocation submitted as input.

The proper usage and application of the TOCOUNTRY function will allow users to transmute ISO codes or specific geolocation identifiers into comprehensive country names, heightening the readability and understanding of data representation.

The Syntax of TOCOUNTRY

The TOCOUNTRY function maintains a fairly simple syntax structure. The function accepts two parameters, with the second being optional. The syntax will look like this:

TOCOUNTRY(X [,Input Format])

Where the parameters are,

  • X
    - A text field or expression, or a geo field or expression.
  • Input Format
    - This is optional, and used to define format for the
    text field.

How the function works

At its core, the TOCOUNTRY function transmutes region specified either as an ISO code or other geographic identifiers into the full-name representation of the corresponding country.

For instance, using "US" as input will yield "United States" as its output.


TOCOUNTRY accepts the following input formats if

is a text field :


If the input "X" is already configured correctly as a geo field, providing the Input Format is optional.


Let's consider a few examples in a sales metrics context. Suppose we have a dataset that contains sales data across different countries, represented by their ISO codes.

Suppose, the raw data is as:

|Country_Code| || |FR| |JP| |IN|

Now, let's consider an application of the TOCOUNTRY function:


Post application of the function, the output would look something like this:

|Country_Code|Country| ||| |FR|France| |JP|Japan| |IN|India|

Limitation of TOCOUNTRY function

While the function is valuable in enhancing data readability, its usage is constrained by the requirement of correct ISO country codes or valid geolocation identifiers. Erroneous codes or identifiers may result in inaccurate output.

Tips for TOCOUNTRY function usage

Tip 1: Ensure the entry for the 'X' parameter is accurately configured as a geo field or as a text field in the acceptable format.

By following these instructions, you will be able to reap the full benefits of Google Data Studio's TOCOUNTRY function to enhance your data analytics and reporting tasks.

More function to use with Looker Studio

Taking Advantage of Google Data Studio's ASIN Function
Working with number and the CEIL function in Looker Studio
Understanding and Utilizing DATE_DIFF Function in Looker Studio: Syntax, Examples, Limitations and Tips
Mastering the SECOND Function in Looker Studio: Extraction, Usage, Examples, and Limitations
Mastering the Use of MAX Function in Looker Studio for Enhanced Business Data Analysis and Insights