TOCONTINENT function: How to use & example
Discover how to use the TOCONTINENT function in Looker Studio to convert country names into their respective continents. Learn syntax and examples.
Google Data Studio presents a bagful of powerful functions among which one of the most cryptographic ones is the TOCONTINENT. As the name suggests, this function has been designed with the objective to unravel the continent name for a certain geolocation. In other words, it essentially returns the continent name of a specified geolocation.
How Does the TOCONTINENT Function Work?
Gracefully fitting into the syntax
TOCONTINENT(X [,Input Format])
, this function operates using some specific parameters. The parameter 'X' can either be a text or a geo field or even an expression. The other parameter Input Format
is utilized to define the format for the text field X, though it is optional if X is appropriately set up as a geo field.
In the case of the
Input Format
, TOCONTINENT accepts SUBCONTINENT_CODE, COUNTRY_ISO_CODE, and REGION_ISO_CODE as inputs if X is a text field.
The usage of the function is described as
TOCONTINENT(Subcontinent Code)
, where Subcontinent code refers to a code that represents a specific subcontinent.
Diving into the Examples
It's a great time to dive into some examples. Knowing how to use the function can come handy while dealing with sales metrics.
Let's consider that you are organizing a sales campaign and would like to measure the effectiveness segregated by continents. Upon using the function properly, the data studio can provide the sales data sorted by continents.
markdown
In this case, the 'Region_ISO_Code' is assumed to represent the sales from different regions in a coded form, following the global ISO standard for regions. The result of this function would be a column listing the name of the continents.
Example: TOCONTINENT(Sales.Region_ISO_CODE)
markdown
In the above instance,
Example: TOCONTINENT("IN")IN
is the country ISO code for India. The function will return Asia
, the continent where India is located.
Sets of Limits and Constraints
Even though TOCONTINENT is an incredibly powerful function, it does have certain constraints. It doesn’t necessarily infer the continent name from all codes. It is possible that there could be an unknown or non-standard code in the list, which might not return a result. Therefore, it is generally suggested to ensure that the geolocation data used conforms with the input format requirements.
Expert Tips to Master the TOCONTINENT Function
Building expertise with the TOCONTINENT function is quite simple. Always ensure that the ISO standard is maintained while using country codes or region codes. Also, the more correctly you use a geo field, the lesser need would be there to use the
Input Format
.
The TOCONTINENT function indeed unlocks a new dimension while organizing and analyzing data, particularly geographical data. It makes the task of segregating data based on places significantly easier and more accurate.