This page refers to the
drill_fields
parameter that is part of a dimension or measure.
drill_fields
can also be used as part of a view, as described on thedrill_fields
(for views) parameter documentation page.
Usage
dimension: field_name {
drill_fields: [field_or_set, field_or_set, …]
}
}
Hierarchydrill_fields |
Possible Field TypesDimension, Dimension within a Dimension Group, MeasureAcceptsA square-bracketed list of field names or set names |
Definition
The drill_fields
parameter controls what happens when a user clicks on the value of a table cell while exploring data. When a user does this they “drill” into the data, allowing them to see the individual records that make up that cell, limit their query to the cell’s value, or slice the data in a related way.
The drill_fields
parameter accepts a list of fields, sets, or a combination of both fields and sets.
If a measure uses the drill_fields
parameter, any drill fields set at the view level will not be applied to that measure.
Drilling can be disabled in some cases:
- When using the
can_filter
parameter - When using the
raw
timeframe in a dimension group
Once users click a drill field, they are taken into a drill overlay. The data in the overlay has a default sort based on the following prioritization:
- The first date dimension, descending
- If no date dimension exists, the first measure, descending
- If no measure exists, the first added dimension, ascending
Drilling into dimensions
When you drill into a dimension, you have several options:
1. Limit the query to the dimension value the user clicked.
In this case, when a user clicks on a dimension value, they can choose to filter on it:
This option is a default behavior for dimensions and doesn’t require the use of drill_fields
.
2. Limit the query to the dimension value the user clicked, and replace the dimension with another.
Another option is to limit the query to a particular value, and replace the dimension with a different, related dimension. For example, you have a country field, and want to drill into it by state. The LookML would look like this:
In the Looker UI, this option will appear as:
In this example, if the user chooses to drill by state, the query is limited to the USA (because that is the value they clicked on), the Country dimension is replaced by State, and the pre-drill measures are carried over into the new query:
Dimension groups of type: time
have drill fields added to them by default. Each timeframe can drill to the more granular timeframes (e.g. week can drill to date and time, but not month). However, you can limit the timeframes that can be drilled to by using the drill_fields
parameter:
Drilling into measures
Drilling into a measure shows the row-level data about the items that comprise that measure. While drill_fields
can be used on any measure type, it generally makes more sense if used with a count
or count_distinct
measure. The information that displays for each row is defined by the fields or sets that you define in drill_fields
.
For example, suppose you have the following LookML:
This results in the following user experience: