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

add

New in Looker 21.6 for the Custom Fields Labs feature is a new improved experience for creating and editing custom fields and table calculations, including the ability to add descriptions to them.

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:

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 gear 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 gear menu. For the gear menu to be visible to you, your admin has to enable custom fields and give you the permissions to create them. If your admin has enabled the Upgraded Explore Field Picker Labs feature, 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). 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 display it in a query. You can also click its Filter button 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 New button on the Custom Fields section:

  1. Expand the Custom Fields section.
  2. Click New. If your admin has enabled the Upgraded Explore Field Picker Labs feature, click Add.
  3. Select the type of field you would like to create. This example uses Custom Measure.

  1. Select a field field to measure and select the measure type from the drop-down options, and then specify a name.
  2. If you want to add a custom filter, type a Looker expression in the filter expression box on the Filters tab, using any Looker functions and operators that can be used in custom filters. The Looker expression editor will suggest field names and give 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 type you are creating are marked with a black circle.

  1. On the Field details tab, you can specify a format and add an optional description to help communicate to users details about the custom field, or 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.

Adding a custom filter to a custom measure

In the example above, you added a custom 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 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 the gear menu for the custom field you want to edit, or, if you’re creating a new custom measure, click New and select Custom Measure. If your admin has enabled the Upgraded Explore Field Picker Labs feature, click an existing custom measure’s three-dot Options menu to edit, or click Add and select Custom Measure to create a new custom measure.

  3. If you’re editing a field, click Edit.

  1. Input the filter expression in the filter expression box on the Filters tab, using any Looker functions and operators that can be used in custom filters. The editor will suggest field names and give 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 type you are creating are marked with a black circle.
    • 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 Average of Order Item Cost to Average Cost of Order Items over $100.
    • Add any desired formatting, or an optional description, on the Field details tab.
  2. Click Save.

Creating a filtered custom 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. 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 gear menu. For the gear menu to be to you, your admin has to enable custom fields and give you the permissions to create them. If your admin has enabled the Upgraded Explore Field Picker Labs feature, click the measure’s three-dot Options menu.
  3. Click Filter Measure.

  1. Specify the name. In the filter expression box, type a filter expression, using any Looker functions and operators that can be used in custom filters. The Looker expression editor will suggest field names and give 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 Save.

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

As with other measures, you can click a custom measures’s name to display it in a query. You can also click its Filter button 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 New. If your admin has enabled the Upgraded Explore Field Picker Labs feature, click Add.
  3. Choose Custom Dimension.

  1. Specify the name and format that you want to use. 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 give 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 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 display it in a query. You can also click its Filter button 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-, 60-, or 90-day sums).

To duplicate a custom field:

  1. In the field picker, expand the Custom Fields section.
  2. Click the gear menu for the custom field you want to duplicate. If your admin has enabled the Upgraded Explore Field Picker Labs feature, 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

  1. In the field picker, expand the Custom Fields section.
  2. Click the gear menu for the custom dimension you want to edit. If your admin has enabled the Upgraded Explore Field Picker Labs feature, 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. If you have changed anything on a custom field, consider modifying the name to match.
  4. Add or update an optional field description, to help communicate to users details about the custom dimension, or its intended use.
  5. Click Save.

Editing a custom measure

  1. In the field picker, expand the Custom Fields section.
  2. Click the gear menu for the custom dimension you want to edit. If your admin has enabled the Upgraded Explore Field Picker Labs feature, 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 Measure type drop-down.
  3. Enter a new field name as desired. 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 from Sum of Sale Price to Sum of Cost.
  4. Add, change, or remove a custom filter in the Filter expression box on the Filters tab.
  5. Add, change, or remove any formatting or field description 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 gear menu for the custom field you want to delete. If your admin has enabled the Upgraded Explore Field Picker Labs feature, click the three-dot Options menu for the custom field you want to edit.
  3. Select Delete.

  1. Click OK to confirm deletion of the field. Looker removes the field from the field picker and the current query (if included).
    • If your admin has enabled the Upgraded Explore Field Picker Labs feature, the field will be deleted without this confirmation.

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