primary_key parameter specifies that a dimension is the primary key for its view. The default value is
false. For example:
- helps Looker to avoid unnecessary
- is necessary to make the
foreign_keyparameter work properly.
- is required for the proper functioning of Symmetric Aggregates. When joining views with measures (aggregates), a
primary_keymust be defined on each side of the join to properly calculate the aggregations.
If you have a primary key that is comprised of multiple columns, you can create a dimension that concatenates those columns, then declare that as your primary key. For example:
Please note that a
dimension_group cannot be used as a primary key if it specifies more than one