- name: customer_count display_name: Customer Count category: customers type: count_distinct unit: customers grain: monthly time_column: created_at table: customers expression: "COUNT(DISTINCT customer_id)" description: "Total number of unique customers. Tracks customer base growth over time. Counts distinct customer records based on registration date." dimensions: - segment - region - acquisition_channel notes: - "Counts only active customers (not deleted or merged)" - "A customer is counted in the month of their first registration" - "Segment is assigned based on lifetime spend thresholds" synonyms: - total_customers - customer_base - active_customers sql: | SELECT DATE_TRUNC('month', created_at) AS month, COUNT(DISTINCT customer_id) AS new_customers FROM customers WHERE status = 'active' GROUP BY 1 ORDER BY 1 sql_by_segment: | SELECT segment, COUNT(DISTINCT customer_id) AS customer_count, AVG(lifetime_value) AS avg_ltv FROM customers WHERE status = 'active' GROUP BY 1 ORDER BY 2 DESC