measure Stay organized with collections Save and categorize content based on your preferences.
Usage
view: view_name { measure:field_name{ ...}}Hierarchy measure | Accepts A Looker identifier to name the measure |
Definition
Themeasure parameter declares a new measure (aggregation) and specifies a name for that measure.
There are several criteria for a measure's name:
- It must be unique within any given view.
- It must consist of characters
athroughz(no capital letters),0through9, or_. - It must start with a letter.
There are many types of measures, as discussed further on theMeasure types documentation page.
Subparameters formeasure
See theField parameters reference page for a list of subparameters that are available for LookML fields.
Tip: You can use theQuick Help panel in the Looker IDE to quickly see the available subparameters for a given LookML field. Click a LookML parameter in the IDE editor panel to update theQuick Help panel to display the supported options and subparameters for that LookML element. Also, you can click a parameter name in theQuick Help panel to open the Looker documentation page for that parameter.Examples
Create measures namedproduct_count andtotal_value in a view namedproducts:
view: products { measure: product_count { type: count } measure: total_value { sql: ${value} ;; type: sum }}Things to know
Measures in joined views
To have measures (aggregations) come through joins, you must define primary keys in all the views that are involved in the join.
You can do this by adding theprimary_key parameter to the primary key field definition in each view:
dimension: id { type: number primary_key: yes}To correctly handle joined measures, Looker relies on you specifying a primary key where the values are completely unique, non-NULL values. If your data does not contain a primary key, consider whether theconcatenation of several fields would result in a primary key of completely unique, non-NULL values. If your primary key is not unique or contains NULL values and your query includes data that reveals those issues, then Looker returns an error as described in theError: Non-Unique value/primary key (or sql_distinct_key), value overflow or collision when computing sum Best Practices page.
Measures based on other measures
It is possible to define a measure that is based on another measure. The new measure must be oftype: number to avoid nested-aggregation errors. See the documentation ontype: number for measures for an example and explanation.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.