Bird
0
0

You wrote this metric definition in dbt YAML:

medium📝 Debug Q14 of 15
dbt - Advanced Patterns
You wrote this metric definition in dbt YAML:
metrics:
  - name: avg_order_value
    model: ref('orders')
    label: 'Average Order Value'
    type: avg
    sql: total_price

But when you run your report, the average is incorrect. What is the likely error?
AThe metric type 'average' is invalid; it should be 'avg'
BThe metric type should be 'average' instead of 'avg'
CThe model reference should not use ref()
DThe 'sql' field should be 'amount' instead of 'total_price'
Step-by-Step Solution
Solution:
  1. Step 1: Check valid metric types in dbt

    dbt metric types include 'average' for average, not 'avg'.
  2. Step 2: Identify the impact of wrong type

    Using 'avg' is invalid and causes incorrect calculation or errors.
  3. Final Answer:

    The metric type should be 'average' instead of 'avg' -> Option B
  4. Quick Check:

    Use 'average' for average metric type [OK]
Quick Trick: Use 'average' not 'avg' for average metrics [OK]
Common Mistakes:
MISTAKES
  • Using 'avg' instead of 'average' as metric type
  • Changing model reference incorrectly
  • Assuming 'sql' field name is wrong

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More dbt Quizzes