Dimension parameter to take labels from different field

This has been on my mind for a while but it gets to me every time I have to deal with maps, which is the best example.

I am very grateful for ISO standards and the fact that most datasets and companies try to follow them. Unfortunately, for the end user that consumes the data, ISO codes are useless, apart from the currencies that people are used to.

A map layer has to be joined with the dimension that is selected. Having a list of ISO2 codes doesn’t really provide people with anything, they can’t read most of it. You either have to select two dimensions and hide one, or you have to try to match different data sources with the map’s property key.

What if those two things were decoupled:

dimension: country {
map_layer_name: custom_countries
sql: ${TABLE}.country
map_join_field: ${TABLE}.iso2_code
}

What the code above achieves is that I don’t care if one table has “US”, another “United States”, and the TopoJSON file has “United States of America”. I can always join it using ISO2 code “US

I can see use cases beyond that where we want to keep machine-readable values like statuses, codes, and so on, but display only their names because we don’t need them in the field picker. (yes we can hide them but imagine if we didn’t have to even add them). 

Also it allows me to change my labels if necessary, without worrying about filters, or changing things. Looker, as a code-first tool would operate on things that do not change but still show nice data to the end user.

dimension: order_status {
sql: ${TABLE}.order_status_id
sql_label: ${TABLE}.order_status
}

In the above example I can completely rename my statuses but if filters were done with status_id = 1, there would be no headache involved.

Let me know your thoughts!

0 1 408
1 REPLY 1

The cleanest workaround thanks to Simone from Looker Support:

dimension: country {
sql: ${TABLE}.country_code_iso2
html: {{ country_name._rendered_value }}
}

It does work as my suggestion above and allows us to connect maps using codes but still display only the country name. The only downside is that the suggestions for the filters will still be the code not the name of the country.

Top Labels in this Space
Top Solution Authors