> ## Documentation Index
> Fetch the complete documentation index at: https://help.treble.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# fact_campaign_daily

> Pre-aggregated daily delivery metrics per campaign.

# fact\_campaign\_daily

Each row is one campaign (`poll_id`) on one day, with sends broken down by outcome and the delivery/response rates already computed. It is the fast path for dashboards: the same numbers you could derive from [`fact_campaign_sends`](/en/docs/data-warehouse-v2/fact-campaign-sends), pre-aggregated. It replaces the legacy `fact_deployment_daily` with identical formulas.

## What questions does it answer?

* How did each campaign perform per day?
* What is the trend of delivery and response rates over time?
* How many sends failed, and in which failure category?

## Columns

| Column                      | Type       | Description                                                       |
| --------------------------- | ---------- | ----------------------------------------------------------------- |
| `company_id`                | Int32      | Your company (filtered automatically)                             |
| `day`                       | Date       | The day (by scheduled time)                                       |
| `poll_id`                   | Int32      | Campaign flow identifier                                          |
| `poll_name`                 | String     | Campaign flow name                                                |
| `sent`                      | UInt64     | Total sends scheduled that day, across all outcomes               |
| `delivered`                 | UInt64     | Sends that reached the phone (`delivered_at` set)                 |
| `responded`                 | UInt64     | Sends the user replied to (`responded_at` set)                    |
| `failure`                   | UInt64     | Failed sends (`failed_at` set — all failure causes combined)      |
| `in_process`                | UInt64     | Sends accepted or in flight, without a final delivery outcome yet |
| `failure_rate_limit`        | UInt64     | Failures: messaging rate limit reached                            |
| `revoked`                   | UInt64     | Sends revoked before sending                                      |
| `invalid_phone`             | UInt64     | Failures: invalid phone number                                    |
| `missing_parameter`         | UInt64     | Failures: missing or mismatched template parameter                |
| `failure_human_handover`    | UInt64     | Failures: the contact was in a conversation with an agent         |
| `deactivated_poll_or_hsm`   | UInt64     | Failures: flow or template deactivated                            |
| `failure_general`           | UInt64     | Failures: general/other                                           |
| `failure_unable_to_contact` | UInt64     | Failures: WhatsApp could not deliver to that number               |
| `optout`                    | UInt64     | Failures: recipient opted out or blocked the line                 |
| `meta_chose_not_deliver`    | UInt64     | Meta chose not to deliver (frequency capping)                     |
| `to_agents`                 | UInt64     | Conversations of this flow handed over to agents that day         |
| `delivered_rate_pct`        | Float64    | `delivered / sent` × 100; `NULL` when `sent` is 0                 |
| `response_rate_pct`         | Float64    | `responded / delivered` × 100; `NULL` when `delivered` is 0       |
| `synced_at`                 | DateTime64 | When this row was last written/corrected                          |

<Note>
  Rows for recent days are recomputed continuously as sends progress — today's row will keep changing until the underlying sends consolidate (within 48 hours). For custom breakdowns not covered here, query `fact_campaign_sends` directly.
</Note>

<Note>
  The failure breakdown columns cover the most common failure causes; `failure` is the authoritative total and can be slightly higher than the sum of the breakdown columns when a send failed for a less common reason. The full detail is always available per send in `fact_campaign_sends.status`.
</Note>

## Example queries

### Last 30 days of one campaign

```sql theme={null}
SELECT day, sent, delivered, responded, delivered_rate_pct, response_rate_pct
FROM fact_campaign_daily
WHERE poll_id = {your_poll_id}
  AND day >= today() - 30
ORDER BY day
```

### Failure breakdown across all campaigns this month

```sql theme={null}
SELECT
    sum(invalid_phone)             AS invalid_phone,
    sum(failure_rate_limit)        AS rate_limit,
    sum(missing_parameter)         AS missing_parameter,
    sum(failure_unable_to_contact) AS unable_to_contact,
    sum(meta_chose_not_deliver)    AS meta_frequency_capping,
    sum(failure_general)           AS general
FROM fact_campaign_daily
WHERE day >= toStartOfMonth(today())
```
