measure parameter declares a new measure (aggregation) and specifies a name for that measure.
The name must:
- be unique within any given view
- consist of characters
z(no capital letters),
- start with a letter
Create a product_count and total_value measure in a view named products:
Things to Know
In order to have measures (aggregations) come through joins, you must define primary keys in all of the views involved in the join.
You can do this by adding the
primary_key parameter to the primary key field definition in each view:
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 the concatenation 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 reveal those issues, then Looker returns an error as described in this Discourse article.