Skip to main content
InterviewHubPRO
Section Overview
Q38

Question 38 of 50

Part 3: Enterprise Scale, Performance & CI/CD Pipelines (Senior / Staff)

76%
dbt Analytics Engineering (50 Qs)•Part 3: Enterprise Scale, Performance & CI/CD Pipelines (Senior / Staff)

dbt Semantic Layer and MetricFlow: Defining metrics once for consistent enterprise BI queries.

senior LevelMost AskedCode ExampleFormsPerformancePipes

In Simple Words: Different departments often calculate "Monthly Active Users" or "Gross Revenue" differently in their own SQL queries, causing conflicting board meeting metrics:

  • Semantic Layer: Define the single source of truth for business metrics in YAML:
    yaml
    semantic_models:
      - name: orders
        model: ref('fct_orders')
        measures:
          - name: revenue
            agg: sum
            expr: order_amount_usd
        dimensions:
          - name: order_date
            type: time
            type_params:
              time_granularity: day
    metrics:
      - name: monthly_revenue
        type: simple
        type_params:
          measure: revenue
    
  • BI tools (Looker, Tableau, Hex) query MetricFlow directly via JDBC/GraphQL, guaranteeing that every dashboard reports identical numbers.