Designing metrics
Cube is a dataset-centric semantic layer, where all primary objects (cubes and views) are table-like datasets. When designing how your semantic layer will be exposed and consumed by end users, you can follow either an entity-first or a metrics-first approach.Entity-first approach
In entity-first approach, views are built around entities in your data model. Views are built as denormalzied tables, bringing measures and dimensions from different cubes needed to fully decscribe the entity.orders or line_items.
In the example below we define orders_view view to describe orders entity. It has multiple measures and dimensions
You can optionally create multiple views to describe single entity.
It can be useful for entities with a large number of dimensions to not overwhelm the end users with all the possible dimensions in a single view,
but instead creating multiple slices of data with only relevant measures and dimensions.
In the example below, we are breaking down orders_view into orders_view and orders_with_users_view.
Only the latter view will contain dimensions related to user who placed the order.
Metrics-first approach
In metrics-first approach, views are built around measures, or metrics, in your data model. Views are built as denormalzied tables, containing one measure and all the relevant dimensions from different cubes. These include all the dimensions you would group or filter by, and up to one time dimension.Views are usually named after that single measure.
This approach improves compatibility with BI tooling and adds clarity for the consumer.