User Guide Help Center Documentation User Forums Training
Looker
Adding a Custom Measure From a Dimension

Most fields in the Field Picker are created by your Looker developers. If your Looker admin has enabled the experimental custom fields feature and given you access, 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. This page discusses creating a custom measure from a dimension.

Quick Guide

There are two ways to create a custom measure from a dimension.

Shortcut

In many cases, you can use this shortcut technique:

  1. Expand the view with the dimension that you want to measure. In this example, we want to do a calculation on the Sale Price dimension. The dimension cannot be a custom dimension.
  2. Click that dimension’s gear menu. (To see the gear menu, your admin has to enable custom fields and give you the right to create them.)
  3. Select a function. In this example, we chose Sum to create a measure that calculates the sum of the order amounts. The functions offered vary, based on the type of dimension (such as number, text, and date). Your new field is automatically added to the query.
  4. When desired, expand the Custom Fields section to see your new field.
  5. Like other measures, you can click a custom measure’s name to display it in a query. You also click its Filter button to use it as a filter in a query.

From the Custom Fields Section

If you want to define a format or a filter for your custom measure while creating it, start with the Custom Field New button:

  1. Expand the Custom Filters section.
  2. Click New.
  3. Choose Custom Measure.
  4. Specify the name, format, dimension, and measure type that you want to use. If you want to add a custom filter, click Custom Filter and type a Looker Expression. The editor will help suggest field names and give syntax help for any functions you use. For more details on using this editor, see the Creating Looker Expressions page. You can use any Looker functions and operators that can be used in other custom filters. You can see details on filling out these fields in the Editing a Custom Field section.
  5. Click Save. The Field Picker displays your new custom measure in the Custom Fields section. Like other measures, you can click a custom measure’s name to display it in a query. You also can click its Filter button to use it as a filter in a query.

Viewing and Using Custom Fields

If you are allowed to create custom fields, then you can see and edit any custom fields in the Custom Fields section of the Field Picker. If another user creates a custom field and passes you the Explore’s URL, then you can see that custom field in the Field Picker. The URL must include the qid parameter (such as myinstance.looker.com/explore/ec/order_items?qid=lEPPueGN7cHkozOEZVDQbO).

You can interact with these custom fields as you would with any other measure or dimension, including filtering on them or adding them to visualizations. (If you create a custom dimension then you can also pivot on that field.) Only users who are allowed to create custom fields can add a custom field to a query in an Explore, Look, or dashboard tile.

If a user cannot create custom fields, then the Field Picker does not display the Custom Fields section and the user cannot add a custom field to a query. However, users do not need any special permissions to see a custom field used in a shared query, Look, or dashboard. Also, users can click Explore from here on a Look or dashboard tile to create a new query using that field. Good naming of fields is important because these users cannot see the definition of a custom field.

Duplicating a Custom Field

If you are allowed to create a custom field, 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.
  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 in the following section.

Editing a Custom Field

If you are allowed to create a custom field, you also can edit custom fields created by you or another user.

Changing a Custom Field’s Name, Format, Field, or Function

To edit 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 delete.
  3. Select Edit.
  4. To change the field name, type the new name in the upper left field. If you changed anything on a custom field, then consider modifying the name to match. A good, clear name is especially critical for users that cannot create custom fields because they cannot see the definition of the field.
  5. To change the value format, click the upper right field and select a format.
  6. To change the field to measure, click Field to measure and select the desired field. If you change this, typically you should change the custom field’s name to match. For example, if you change a Sale Price field to a Cost field, then change the custom field’s name from Sum of Sale Price to Sum of Cost.
  7. To change the type of function, click Measure type and select the desired function. If you change this, typically you should change the custom field’s name to match. For example, if you change a Sum function to an Average function, then change the custom field’s name from Sum of Sale Price to Average of Sale Price.
  8. Click Save.

Adding a filter to a custom field is discussed in the next section.

Adding a Custom Filter to a Custom Field

You can add a custom filter for a measure to limit the data, such as only including orders from certain regions. To add a filter to 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 delete.
  3. Select Edit.
  4. Click the Custom Filter box.
  5. Type your expression. The editor will help suggest field names and give syntax help for any functions you use. For more details on using this editor, see the Creating Looker Expressions page. You can use any Looker functions and operators that can be used in other custom filters.
  6. Consider changing the custom field’s name to reflect the new filter condition. In this example, consider changing the field name from Sum of Sale Price to Sum of Sale Price in France or Japan.
  7. Click Save.

Deleting a Custom Field

If you are allowed to create a custom field, you also can edit custom fields created by you or another user. 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.
  3. Select Delete.
  4. Click OK to confirm deleting the field. Looker removes the field from the Field Picker and the current query (if included).

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.

Additional Ways to Add Fields

There are several ways to add new fields to your explore:

Tips for Looker Admins and Developers

Click to see tips for Looker Admins and Developers

Custom fields are an experimental feature so may change or be removed from the product.

Also, they are not a data security feature. As described above, other users can still see the custom fields in shared queries, Looks, and dashboard tiles. They also can use Explore from here to create new queries with those fields.

Enable custom fields if you want to let some of your business users:

  • Visualize unmodelled data using Instant Explore from the SQL Runner.
  • Create semi-permanent measures and dimensions for a one-off or infrequent analysis.
  • Create semi-permanent measures and dimensions without the need of an analyst.

Enabling the Custom Fields Lab Feature

To enable using custom fields, a Looker Admin needs to:

  1. Navigate to the Admin Panel’s Groups page.
  2. Click Add Group.
  3. Create a group called Custom Fields Beta Users.
  4. Click Create.
  5. Click Labs to navigate to the Admin Panel’s Labs page.
  6. Scroll down to the Experimental section.
  7. Click the Custom Fields switch to turn the feature ON.

To allow users to create and select custom fields:

  1. Navigate to the Admin Panel’s Groups page.
  2. Edit the Custom Fields Beta Users group to add any groups or users you want to allow to create custom fields. Even Looker admins do not have access unless added to this group.
  3. Verify that the user is assigned to a role that has the create_table_calculations permission.
  4. Notify these users that they will no longer see the Calculations button to create table calculations. In the Field Picker, they should expand Custom Fields. From there they can use and edit existing table calculations. They also can click New and select Table Calculation to create a new one as shown below:

Custom Fields and the LookML Model

Although custom fields rely on the LookML model, they are not part of the modeling layer and do not appear in any view files. You cannot save or convert a custom field to a LookML field.

Consider using custom fields instead of LookML for fields that are only needed temporarily or only by your most sophisticated users.

You Can Create a Custom Field in SQL Runner

You can use custom fields to visualized unmodelled fields in SQL Runner, as described on the Using SQL Runner page.

Changing the Field Picker Choices Using LookML

To learn the various ways that a Looker developer can use LookML to create and modify the fields available in the Field Picker, see the Changing the Explore Menu and Field Picker page.

Top