Bird
0
0

Given this metric definition: metrics: - name: total_orders model: ref('orders') type: count expression: order_id What will be the output of querying this metric if the 'orders' model has 150 rows?

medium📝 Predict Output Q4 of 15
dbt - Advanced Patterns
Given this metric definition: metrics: - name: total_orders model: ref('orders') type: count expression: order_id What will be the output of querying this metric if the 'orders' model has 150 rows?
AAn error because count needs no expression
BThe sum of all order_id values
C150
D0
Step-by-Step Solution
Solution:
  1. Step 1: Understand count metric behavior

    A count metric counts the number of rows based on the expression column.
  2. Step 2: Apply to given data

    Since 'orders' has 150 rows, counting 'order_id' returns 150.
  3. Final Answer:

    150 -> Option C
  4. Quick Check:

    Count metric output = number of rows [OK]
Quick Trick: Count metrics return row counts, not sums [OK]
Common Mistakes:
MISTAKES
  • Thinking count sums values instead of counting rows
  • Assuming expression is optional for count
  • Expecting zero output without filtering

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes