label

LookML
Version

On this Page
Docs Menu

Go to Field Parameter List

This section refers to the label parameter that is part of a dimension, dimension_group, measure, or filter

label can also be used as part of a model, described here

label can also be used as part of an explore, described here

label can also be used as part of a view, described here

label can also be used as part of a reference line, described here

Definition

The label parameter allows you to change how a field name will appear in the Field Picker. If not specified, the label defaults to the name of the field.

Fields with labels are still referenced with the normal ${view_name.field_name} syntax in LookML. The label only affects the appearance of the Field Picker.

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 as in_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.

In this example, the name dimension changes its label value depending on a company user attribute:

- dimension: name label: "{% if _user_attributes['company'] == 'Looker' %} Employee Name {% else %} Customer Name {% endif %}" sql: ${TABLE}.name

Examples

Make this measure appear as # of Customers instead of Customer Count Distinct in the Field Picker.

- measure: customer_count_distinct label: '# of Customers' type: count_distinct sql: ${customer.id}

Still have questions?
Go to Discourse - or - Email Support
Top