This page refers to the
group_label
parameter that is part of a field.
group_label
can also be used as part of an Explore, as described on thegroup_label
(for Explores) parameter documentation page.
Usage
view: view_name { dimension: field_name { group_label: "desired label name" } }
Hierarchy
group_label |
Possible Field Types
Dimension, Dimension Group, Filter, Measure
Accepts
A string
|
Definition
The group_label
parameter lets you combine fields into custom groups, within a given view, in the field picker. For example:
view: accounts {
dimension: shipping_city {
sql: ${TABLE}.shipping_city ;;
group_label: "Shipping Info"
}
dimension: shipping_state {
sql: ${TABLE}.shipping_state ;;
group_label: "Shipping Info"
}
dimension: shipping_street {
sql: ${TABLE}.shipping_street ;;
group_label: "Shipping Info"
}
}
In this case, instead of the fields appearing ungrouped, they are combined into an expandable Shipping Info section.
You can also use the group_item_label
parameter to specify how fields appear in the field picker under a group label. See the group_item_label
parameter documentation page for details.
group_label
also interacts with dimension groups in useful ways, since a dimension group automatically places its fields together in the field picker. By using group_label
, you can add additional fields into the dimension group. For example:
view: accounts {
dimension_group: created {
type: time
timeframes: [date, week, month]
sql: ${TABLE}.created_date ;;
}
dimension: special_date_calculation {
sql: QUARTER(${TABLE}.created_date)
group_label: "Created Date" ;;
}
}
In the field picker, the Special Date Calculation
field would appear in the Created Date
dimension group.
You must have at least one field with the group label to create a group in the field picker. In addition, you can't group dimensions and measures together under the same group label, because all dimensions always appear separately from all measures within any given view.
For example, the following code creates a field named Engine Type
inside a group label named Engine Details
:
dimension: engine_type {
group_label: "Engine Details"
type: string
sql: ${TABLE}.engine_type ;;
}