User Guide Getting Started Help Center Documentation Community Training
New LookML
Old LookML
New LookML
  
English
日本語
label (for Fields)

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 this documentation page.

label can also be used as part of an Explore, described on this documentation page.

label can also be used as part of a view, described on this documentation page.

label can also be used as part of a reference line, described on this documentation page.

Usage

view: view_name {
  dimension: field_name {
    label: "desired label name"
  }
}

Hierarchy

label

Possible Field Types

Dimension, Dimension Group, Measure, Filter, Parameter

Accepts

A string

Definition

label helps make Explores more user-friendly by allowing you to set the field names that 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.

For example, the Liquid variable {{ _user_attributes['name_of_attribute'] }} replaces the Liquid variable with the value of the specified user attribute. If a user had a user attribute called name with a value of “John Smith”, the following label syntax would change the name of the field in the Field Picker to John Smith:

label: "{{ _user_attributes['name'] }}"

In the next example, the name dimension uses the Liquid {% if %} {% else %} {% endif %} structure with the _user_attributes['name_of_attribute'] Liquid variable to change 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} ;; }

Top