This section refers to the
label
parameter that is part of a field.
label
can also be used as part of a model, described on thelabel
(for models) parameter documentation page.
label
can also be used as part of an Explore, described on thelabel
(for Explores) parameter documentation page.
label
can also be used as part of a view, described on thelabel
(for views) parameter documentation page.
label
can also be used as part of a reference line, described on the Dashboard reference line parameters documentation page.
Usage
dimension: field_name {
label: "desired label name"
}
}
Hierarchylabel |
Possible Field TypesDimension, Dimension Group, Measure, Filter, ParameterAcceptsA string |
Definition
label
helps make Explores more user-friendly by allowing you to choose how field names appear in the field picker and in the data table of an Explore. If no label is specified, the label defaults to the name of the field.
The label affects only the displayed name of the field in an Explore and does not affect how you refer to the field in LookML. Fields with labels are still referenced with the normal ${view_name.field_name}
syntax in your LookML files.
Liquid variables with label
You can use Liquid variables with the label
parameter. Liquid variables let you access data such as information about a model or Explore, filters applied to a field, and user attribute values. You can use Liquid variables to dynamically change the label
value, thus changing the field’s appearance in the field picker and data visualizations.
Liquid variables that return a value based on a filter, such as
_filters
, or require that a query be run first, such asin_query
, will not change the name of the field in the field picker. In those cases, the field name will only be changed in the resulting visualization.
For example, the Liquid variable {{ _user_attributes['name_of_attribute'] }}
label
syntax would change the name of the field in the field picker to John Smith:
In the next example, the name
dimension uses the Liquid {% if %} {% else %} {% endif %}
_user_attributes['name_of_attribute']
label
value depending on a company user attribute:
You can see additional examples of using label
with Liquid variables to define dynamic labels in this Help Center article.
Examples
Make this measure appear as # of Customers instead of Customer Count Distinct in the field picker.