How strict is Looker Studio when it comes to country names? What happens if you use an invalid country name? And how do you fix things when they go wrong?
This post is for anyone using country data with Looker Studio (formerly Google Data Studio). If the field containing your country names has an unknown or invalid value, Looker Studio won't give it the 'Country' type. Instead it sets that field to 'Text':
For example, take the country North Macedonia. Before 2019, this country was known by a variety of names including 'Macedonia', 'Macedonia, the Former Yugoslav Republic of', and 'FYR Macedonia'.
Looker, however, expects only the value 'North Macedonia'. So if you use a data source containing any of the other names, Looker will set your country field to a dimension with the 'Text' type.
This is almost certain to be the case if your data source predates 2019, but it's also possible with more recent data sources. The product analytics tool Mixpanel, for example, still uses the name 'Macedonia, the Former Yugoslav Republic of' and you'll find this value in country data exported from Mixpanel.
So your data source contains a list of countries and at least one unknown/invalid value. As a result, Looker Studio has set your country field to 'Text' rather than 'Country'. When you try to use that data source with, say, a geo chart in Looker Studio, you'll get the following error:
Chart configuration incomplete - Invalid/Missing dimensions, metrics, or filters.
The details for this error look like this:
Also, in the geo chart setup tab, the field 'Geo dimension' will display 'Invalid dimension':
And you won't be able to select your country field as the geo dimension.
Fortunately, you can easily resolve this by manually changing the country field 'type' from 'Text' to 'Country'. Here's how:
It gets more interesting! Once you have set your Country field to the 'Country' type and updated your geo chart, the chart will correctly display any values for 'Macedonia', 'Macedonia, the Former Yugoslav Republic of', or 'FYR Macedonia'. So there's no need to change the errant country name in the source data itself.
It seems slightly odd that Looker Studio is so strict about country names when it comes to identifying data type, yet much more relaxed when it comes to visualising that data. But it's much easier to change the type once than find and fix invalid country names, so that's probably for the best.
Have you come here for a full list of country names that are valid in Looker Studio? Well, please use the names from: https://www.worldometers.info/geography/alphabetical-list-of-countries/
I haven't extensively tested this list but it is recommended by Optimize Smart so that's good enough for me. And the list is certainly correct about North Macedonia!