Bird
0
0

Given this metric definition in dbt YAML:

medium📝 Predict Output Q13 of 15
dbt - Advanced Patterns
Given this metric definition in dbt YAML:
metrics:
  - name: total_revenue
    model: ref('orders')
    label: 'Total Revenue'
    type: sum
    sql: amount

What will be the output of querying this metric if the 'orders' table has amounts: [100, 200, 300]?
A600
B3
C100
D900
Step-by-Step Solution
Solution:
  1. Step 1: Understand metric type and SQL field

    The metric type is 'sum' on the 'amount' field, so it adds all amounts.
  2. Step 2: Calculate sum of amounts

    Sum of [100, 200, 300] = 100 + 200 + 300 = 600.
  3. Final Answer:

    600 -> Option A
  4. Quick Check:

    Sum amounts = 600 [OK]
Quick Trick: Sum metric adds all values in the specified column [OK]
Common Mistakes:
MISTAKES
  • Confusing sum with count (3 rows)
  • Picking a single value instead of sum
  • Adding incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes