home User Guide Getting Started Help Center Documentation Community Training Certification
menu
close
settings
Looker keyboard_arrow_down
language keyboard_arrow_down
English
Français
Deutsch
日本語
search
print
Adding custom fields

Most fields in the field picker are created by your Looker developers. By using custom fields, however, you can add new custom dimensions and measures yourself. Unlike table calculations, a new custom field becomes a new field picker choice on that Explore for certain users.

To use custom fields, your Looker admin must:

  1. Enable the Custom Fields Labs feature.
  2. Grant the create_table_calculations permission to users or groups to allow access to the feature.

When you have access to custom fields, there are several types of custom fields you can create:

If you use the count custom measure field type, a count distinct is executed in the generated SQL.

Creating a custom measure from a dimension

You can create a custom measure from a dimension in one of the following ways:

Using the dimension’s three-dot Options menu

In many cases, you can use this shortcut technique:

  1. Expand the view that contains the dimension that you want to measure. In this example, you want to do a calculation on the Cost dimension.
  2. Click the dimension’s three-dot Options menu.
  3. Select a function. This example uses Average to create a measure that calculates the average of an order item’s cost. The suggested functions vary based on the type of dimension you’ve chosen (such as number, text, and date). If you select count, a count distinct is executed in the generated SQL. Your new field is automatically added to the query.

  1. Expand the Custom Fields section to see your new field.
  2. As with other fields, you can click a custom field’s name to add or remove it from a query. You can also hover over the field to reveal more options available for that field, including clicking its Filter icon to use it as a filter in a query.

Using the Custom Fields section

If you want to define a format or a filter for your custom measure while creating it, start with the Add button on the Custom Fields section:

  1. Expand the Custom Fields section.
  2. Click Add.
  3. Select the type of field you want to create. This example uses Custom Measure.

  1. Select a field to measure, select the measure type from the drop-down options, and then specify a name. If you select count, a count distinct is executed in the generated SQL. The field name appears in the field picker and in the data table.
  2. If you want to add a filter condition, select a field from the Select a field drop-down on the Filters tab. You can also click the downward-facing arrow next to Custom filter to create a custom filter expression using any Looker functions and operators that can be used in custom filters. The Looker expression editor will suggest field names and display syntax help for any functions you use. Fields that are both currently used in an Explore and eligible to be used with the field type that you are creating are marked with a black circle. Refer to the Adding a custom filter to a custom measure section on this page for more details about adding filters to measures.

  1. On the Field details tab, you can specify a format and add an optional description to give other users additional details about the custom field, including its intended use.
  2. Click Save.

The field picker displays your new custom measure in the Custom Fields section. As with other fields, you can click a custom field’s name to display it in a query. You can also click its Filter button to use it as a filter in a query.

Custom grouping

The Group custom field type lets you create ad hoc custom groups for dimensions and custom dimensions without needing to use logical functions in Looker expressions or needing to develop CASE WHEN logic in sql parameters or type: case fields.

This can be helpful when you want to assign fixed labels or category names to values that match specific conditions, for example, by grouping specific states or countries into regions or order costs into categories.

To create a group:

  1. Expand the view that contains the dimension for which you want to create custom groups. In this example, you want to create custom groups for the State dimension.
  2. You can perform the next step in two different ways:
    • Expand the view, click the dimension’s three-dot Options menu, and then click Group to open the Group By menu.
    • If the field is already selected in an Explore, you can select Group from the dimension’s gear menu in the Data table to open the Group By menu, and follow the next steps to create custom groups.

  1. Specify a label for the first group of values. In this example, we are creating a group of states for the Pacific Northwest region of the United States.
  2. Click the default condition, is any value, to customize the conditions that you want to apply for the group.
  3. Select the condition, and enter or select one or more values. In this case, one of the conditions applied is State is Oregon. Click the plus sign (+) next to the value to add multiple conditions for the selected field, or click outside of the filter condition settings to save.
    • When available, value suggestions will appear in a drop-down list, which is indicated with a downward-facing arrow in the value input box, for users to select or search against. Suggestions are most commonly available for fields of type: string.
    • Looker automatically applies SQL conditions such as AND or OR logic when multiple conditions are created, based on the field types, conditions, and values that you specify.
    • If you’re editing an existing custom group, consider changing the name to reflect the updated conditions.

  1. To add more groups for that dimension, hover over the existing group and click the plus sign (+); to remove groups, click the minus sign (-). You can edit an existing group by clicking the group condition — is Oregon or Idaho or Washington in this case.
    • Looker automatically applies SQL conditions such as AND or OR logic when multiple conditions are created, based on the field types, conditions, and values that you specify.
  2. Optionally, click the Group remaining values checkbox to create a category for grouping all other values that do not satisfy any group conditions. In this example, any state that is not Oregon, Idaho, or Washington would be grouped under a label named Other. Other is the default name, but you can customize it, as desired.
    • If you are editing a custom group and want to remove grouping for all other values, click the Group remaining values checkbox to remove that group.

  1. Specify a name other than the default as desired. The field name appears in the field picker and in the data table. The default name for custom groups is Dimension_Name Groups; in this case, the name is State Groups.
  2. Click + Add Description to add an optional description of up to 255 characters to give other users more information about the custom group.
    • If you are editing a custom group and there is an existing description, the Description box will automatically appear.
  3. Click Save.

The new field will appear in the data table, and it displays labels for states depending on whether they are or are not in the Pacific Northwest region:

You can use the new group to make new insights into your data. For example, compare how many orders have been placed by users in the Pacific Northwest region to users living in other regions in the United States:

The new field will appear in the Custom Fields section of the field picker. As with other fields, you can click the field’s name to add or remove it from a query. You can also hover over the field to reveal more options available for that field, including clicking its Filter icon to use it as a filter in a query.

Custom binning

The Bin custom field type lets you create ad hoc custom bins, or tiers, for numeric type dimensions and custom dimensions without needing to use logical functions in Looker expressions or needing to develop type: tier LookML fields.

This can be helpful when you want to quickly group values into specific integer ranges to adjust the granularity of your data.

Bin custom fields appear in the classic tier notation style.

To create a bin:

  1. Expand the view that contains the dimension for which you want to create custom bins. In this example, you want to create custom bins for the Cost dimension.
  2. You can perform the next step in two different ways:
    • Expand the view, click the dimension’s three-dot Options menu, and then click Bin to open the Bin menu.
    • If the field is already selected in an Explore, you can select Bin from the dimension’s gear menu in the Data table to open the Bin menu, and follow the next steps to create custom bins.

  1. As an optional starting point, click Get field info to learn more about the values for the dimension for which you are creating custom bins, including the dimension’s minimum value, its maximum value, and its range of values. Having this information can be helpful in determining the way in which you specify value bins.
  2. Select a Bin type.
    • Select Equal-sized to bin numeric values into equal integer ranges. For example, tiers of values ranging from 0-10, 10-20, and 20-30.
    • Select Custom-sized to create custom bin sizes of varying integer ranges. For example, tiers of values ranging from 0-15, 15-75, and 75-100.
  3. Customize the bin sizes and ranges.
    • If the selected Bin type is Equal-sized, input the desired Bin size, Minimum value, and Maximum value. The preceding example displays specifications of bins of 10, ranging from 0 to 100. Bins will automatically be created for values in the data that fall outside the specified ranges.
    • If the selected Bin type is Custom-sized, specify the tier breakpoints in ascending order in the Bin breakpoints field, separated either by commas or new lines.
  4. Specify a name other than the default as desired. The field name appears in the field picker and in the data table. The default name for custom bins is Dimension_Name Bins; in this case, the name is Cost Bins.
  5. Click + Add Description to add an optional description of up to 255 characters to give other users more information about the custom bin.
    • If you are editing a custom bin that has an existing description, the Description box automatically appears.
  6. Click Save.

The new field will appear in the data table, and it displays tier levels for values depending on where they fit into specified bins:

You can use the new bin to make new insights into your data. For example, you can compare the number of orders that contain items priced in specific cost ranges:

The new field will appear in the Custom Fields section of the field picker. As with other fields, you can click the field’s name to add or remove it from a query. You can also hover over the field to reveal more options that are available for that field — for example, you can click the field’s Filter icon to use it as a filter in a query.

Adding a filter to a custom measure

Applying filters to custom measures allows a measure to limit the data, such as only including orders from certain regions. You can add a custom filter to a custom measure when you’re creating or editing a custom measure. To add a filter to a custom measure:

  1. In the field picker, expand the Custom Fields section.
  2. Click Add and select Custom Measure to create a new custom measure, or click an existing custom measure’s three-dot Options menu to edit an existing custom measure.
  3. If you’re editing a field, click Edit.

  1. Select the field you want to filter by from the Select a field drop-down. In this example, the user chooses to filter by Cost.
  2. Click is any value to customize the filter conditions that you want to apply.
  3. Select the condition, and enter or select a value. In this case, the condition applied is Cost is > 100. Click the plus sign (+) next to the value to add multiple conditions for the selected field, or click outside of the filter condition settings to save.
    • When available, value suggestions will appear in a drop-down list, which is indicated with a downward-facing arrow in the value input box, for users to select or search against. Suggestions are most commonly available for fields of type: string.
    • If you’re editing an existing custom measure, consider changing the custom measure’s name to reflect the filter condition. The field name appears in the field picker and in the data table. In this example, the field name was changed from Average of Order Item Cost to Average Cost of Order Items over $100.

  1. To add more filters, hover over the existing filter and click the plus sign (+); to remove filters, click the minus sign (-).
    • Looker automatically applies SQL conditions such as AND or OR logic when multiple filters are created, based on the field types, conditions, and values that you specify.

  1. Optionally, click the downward-facing arrow next to Custom filter at the bottom of the Filters tab to expand the Custom filter text box to add a custom filter instead of or in addition to a UI-based filter. Type a Looker expression in the Custom filter box using any Looker functions and operators that can be used in custom filters. The Looker expression editor will suggest field names and display syntax help for any functions you use. Fields that are both currently used in an Explore and eligible to be used with the field type that you are creating are marked with a black circle.
  2. Add any desired formatting and an optional description of up to 255 characters on the Field details tab.
  3. Click Save.

Creating a filtered measure from another measure

To create a custom measure that copies an existing measure and adds a filter:

  1. Expand the view that contains the measure to which you want to add a custom filter. The measure cannot be a custom measure or a type: number measure. To add a filter expression to an existing custom measure, you will need to edit the custom measure. In this example, a filter expression is added to the Count measure.
  2. Click that measure’s three-dot Options menu.
  3. Click Filter Measure.

  1. Specify the name. The field name appears in the field picker and in the data table. In the Filters section, select the field you want to filter by from the Select a field drop-down. In this example, the user chooses to filter by Category.
  2. Click is any value to customize the filter conditions that you want to apply.
  3. Select the condition, and enter or select a value. In this case, the condition applied is Category is Accessories. Click the plus sign (+) next to the value to add multiple conditions for the selected field, or click outside of the filter condition settings to save.
    • When available, value suggestions will appear in a drop-down list, which is indicated with a downward-facing arrow in the value input box, for users to select or search against. Suggestions are most commonly available for fields of type: string.
    • If you’re editing an existing custom measure, consider changing the custom measure’s name to reflect the filter condition. In this example, the field name was changed from the default Filtered Inventory Items - Count to Accessories Inventory Count.

  1. To add more filters, hover over the existing filter and click the plus sign (+); to remove filters, click the minus sign (-).
    • Looker automatically applies SQL conditions such as AND or OR logic when multiple filters are created, based on the field types, conditions, and values that you specify.

  1. Optionally, click the downward-facing arrow next to Custom filter at the bottom of the Filters tab to expand the Custom filter text box to add a custom filter instead of or in addition to a UI-based filter. Type a Looker expression in the Custom filter box using any Looker functions and operators that can be used in custom filters. The Looker expression editor will suggest field names and display syntax help for any functions you use. Fields that are both currently used in an Explore and eligible to be used with the field type that you are creating are marked with a black circle.
  2. Add any desired formatting and an optional description of up to 255 characters on the Field details tab.
  3. Click Save.

The field picker displays the new measure in the Custom Fields section:

As with other measures, you can click a custom measure’s name to add or remove it from a query. You can also hover over the field to reveal more options available for that field, including clicking its Filter icon to use it as a filter in a query.

Creating a custom dimension using a Looker expression

To create a custom dimension using a Looker expression and one or more other dimensions:

  1. Expand the Custom Fields section.
  2. Click Add.
  3. Choose Custom Dimension.

  1. Specify the name and format that you want to use. The field name appears in the field picker and in the data table. In the Expression box, type a Looker expression that calculates the value for your dimension, using any Looker functions and operators. The Looker expression editor will suggest field names and display syntax help for any functions you use. Fields that are currently used in an Explore and that are eligible to be used with the field you are creating are marked with a black circle.
  2. Click + Add Description to add an optional description of up to 255 characters to give other users more context or information about the custom dimension.
  3. Click Save.

The field picker displays your new custom dimension in the Custom Fields section:

As with other fields, you can click a custom dimension’s name to add or remove it from a query. You can also hover over the field to reveal more options available for that field, including clicking its Filter icon to use it as a filter in a query.

Viewing and using custom fields

The ability to see custom fields, and how you can interact with them, will be different depending on whether you are allowed to create them or not.

Viewing custom fields

If you’re allowed to create custom fields, then you can see and edit any that appear in the Custom Fields section of the field picker.

If you’re not allowed to create custom fields, then the Custom Fields section is not displayed in the field picker.

However, if you include a custom field in an Explore, a Look, or a dashboard tile, any users with whom you then share that content can see the custom field regardless of whether they have the ability to create custom fields. If you’re sharing this content by sharing an Explore’s URL, the URL must include the qid parameter (such as instance_name.looker.com/explore/ec/order_items?qid=lEPPueGN7cHkozOEZVDQbO). Users who aren’t allowed to create custom fields will see only the field’s title, not its description, so it’s important to name fields precisely if you’ll be using them in queries shared with these users.

Using custom fields

If you’re allowed to create custom fields, then you can edit and use any that appear in the Custom Fields section of the field picker. You can interact with them almost exactly as you would with any other measures or dimensions, including filtering on them, adding them to visualizations, and (for custom dimensions) using them as pivots. One exception is that you cannot use custom fields to create dashboard filters.

Only users who are allowed to create custom fields can add them to queries in Explores, Looks, or dashboard tiles. However, if a user clicks Explore from here on a shared Look or dashboard tile that includes a custom field, they can create a new query using that field whether or not they have the ability to create custom fields.

Duplicating a custom field

If you’re allowed to create custom fields, you can also duplicate existing custom fields. Duplicating and then editing custom fields can be helpful if you’d like to create multiple custom fields with only small differences (for example, 30-day, 60-day, or 90-day sums).

To duplicate a custom field:

  1. In the field picker, expand the Custom Fields section.
  2. Click the three-dot Options menu for the custom field you want to duplicate.
  3. Select Duplicate.

The duplicated field appears below the original, using the name of the original field plus the word “Copy” appended to the end.

Next, you can edit the duplicated field, as described below.

Editing a custom field

If you’re allowed to create custom fields, you also can edit custom fields that you or other users have created.

Editing a custom dimension

To edit a custom dimension:

  1. In the field picker, expand the Custom Fields section.
  2. Click the three-dot Options menu for the custom field you want to edit.
  3. Select Edit.

  1. Change the custom dimension definition.
  2. Select a new format from the Format drop-down if desired.
  3. Enter a new field name as desired. The field name appears in the field picker and in the data table. If you have changed anything on a custom field, consider modifying the name to match.
  4. Add or update an optional field description of up to 255 characters, to help communicate to users details about the custom dimension, or its intended use.
    • If there is an existing description, the Description box will automatically appear. If there is no existing description, click + Add Description to add an optional description.
  5. Click Save.

Editing a custom measure

To edit a custom measure:

  1. In the field picker, expand the Custom Fields section.
  2. Click the three-dot Options menu for the custom field you want to edit.
  3. Select Edit.

  1. To change the field that should be measured, select a new field from the Field to measure drop-down.
  2. To change the type of measure function, select a new measure type from the Measure type drop-down. If you select count, a count distinct is executed in the generated SQL.
  3. Enter a new field name as desired. The field name appears in the field picker and in the data table. If the field or measure type were changed, the custom measure’s name should typically be changed to match. For example, if the field Sale Price is changed to Cost, the custom field’s name should also be changed, in this case from Sum of Sale Price to Sum of Cost.
  4. Add, change, or remove a UI-based or custom filter in the Filter expression box on the Filters tab.
    • If there is an existing custom filter, the Custom filter box will automatically appear. If there is no existing custom filter, click the downward arrow next to Custom filter to add an optional custom filter instead of or in addition to a UI-based filter.
  5. Add, change, or remove any formatting or field description of up to 255 characters by clicking the Field details tab.
  6. Click Save.

Deleting a custom field

If you’re allowed to create custom fields, you can also delete custom fields you or other users have created. When you delete a custom field, it disappears from the Explore but not from any Looks or dashboard tiles that use that field. Also, anyone using a URL for an Explore that had the custom field will still have the field.

To delete a custom field from the field picker:

  1. In the field picker, expand the Custom Fields section.
  2. Click the three-dot Options menu for the custom field you want to delete.
  3. Select Delete.

You can also use the keyboard shortcuts Command-K (Mac) or Ctrl+K (Windows) to delete custom fields.

You can reinstate a custom field that you’ve deleted by clicking the back arrow on your browser.

Top