> ## 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_deployment_daily

> Pre-aggregated delivery metrics per campaign per day.

# fact\_deployment\_daily

Pre-aggregated table with delivery counts per campaign and day, broken down by status. Ideal for general metric dashboards without having to aggregate over the detail table.

## What questions does it answer?

* How many deliveries were made per campaign per day?
* What was the delivery and response rate?
* How many failures occurred and of what type?
* How many users moved on to speak with an agent?

## Columns

| Column                      | Type    | Description                                  |
| --------------------------- | ------- | -------------------------------------------- |
| `company_id`                | Int32   | Company identifier (filtered automatically)  |
| `day`                       | Date    | Calendar day                                 |
| `poll_id`                   | Int32   | Campaign identifier                          |
| `poll_name`                 | String  | Campaign name                                |
| `sent`                      | UInt32  | Total deliveries                             |
| `delivered`                 | UInt32  | Delivered to the user                        |
| `responded`                 | UInt32  | Responded by the user                        |
| `failure`                   | UInt32  | Failed                                       |
| `in_process`                | UInt32  | In process                                   |
| `failure_rate_limit`        | UInt32  | Failed due to rate limit                     |
| `revoked`                   | UInt32  | Revoked                                      |
| `invalid_phone`             | UInt32  | Invalid phone                                |
| `missing_parameter`         | UInt32  | Missing parameter                            |
| `failure_human_handover`    | UInt32  | Failed due to active conversation with agent |
| `deactivated_poll_or_hsm`   | UInt32  | Deactivated campaign or template             |
| `failure_general`           | UInt32  | General failure                              |
| `failure_unable_to_contact` | UInt32  | Unable to contact                            |
| `optout`                    | UInt32  | User opted out of receiving messages         |
| `meta_chose_not_deliver`    | UInt32  | Meta chose not to deliver                    |
| `to_agents`                 | UInt32  | Users that moved to agent                    |
| `delivered_rate_pct`        | Float64 | Delivery rate (%)                            |
| `response_rate_pct`         | Float64 | Response rate (%)                            |

## Example queries

### Summary of the last 2 weeks

```sql theme={null}
SELECT
    poll_name,
    sum(sent) AS sent,
    sum(delivered) AS delivered,
    sum(responded) AS responded,
    sum(to_agents) AS moved_to_agent,
    round(sum(delivered) * 100.0 / nullIf(sum(sent), 0), 1) AS delivery_rate_pct
FROM client_analytics.fact_deployment_daily
WHERE day >= today() - 14
GROUP BY poll_name
ORDER BY sent DESC
```
