Complete the code to define a simple metric that counts orders.
metrics:
- name: order_count
model: orders
label: "Order Count"
type: [1]The count type counts the number of rows, which is suitable for counting orders.
Complete the code to define a metric that sums the revenue column.
metrics:
- name: total_revenue
model: sales
label: "Total Revenue"
type: [1]
sql: revenueThe sum type adds up all values in the revenue column, giving total revenue.
Fix the error in the metric definition by completing the missing field.
metrics:
- name: average_order_value
model: orders
label: "Average Order Value"
type: sum
sql: total_amount
[1]: order_countThe expression field defines how to calculate the metric, such as dividing sum by count for average.
Fill both blanks to create a semantic layer metric that filters by date and groups by customer.
metrics:
- name: monthly_revenue
model: sales
label: "Monthly Revenue"
type: sum
sql: amount
filters:
- field: [1]
operator: >=
value: '2024-01-01'
dimensions:
- [2]The filter uses order_date to select recent data, and grouping is done by customer_id to see revenue per customer.
Fill all three blanks to define a metric with a time grain, filter, and label.
metrics:
- name: daily_active_users
model: user_activity
label: [1]
type: count
time_grains:
- [2]
filters:
- field: [3]
operator: =
value: 'active'The label is "Daily Active Users", the time grain is day for daily counts, and the filter uses the status field to select active users.