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

> Pre-aggregated daily productivity metrics per agent.

# fact\_agent\_daily

Each row is one agent on one day, with their workload, speed, resolution, and satisfaction metrics already computed. It is the fast path for agent-performance dashboards; for custom cuts, derive from [`fact_agent_conversations`](/en/docs/data-warehouse-v2/fact-agent-conversations) and [`fact_agent_conversation_messages`](/en/docs/data-warehouse-v2/fact-agent-conversation-messages).

## What questions does it answer?

* How many chats did each agent handle, resolve, and transfer per day?
* What are each agent's response times and CSAT?
* How many minutes was each agent available?
* What share of conversations got a first response within the 2-minute service-level target?

<Note>
  A row exists only for days on which the agent **sent at least one message**. Conversation metrics attribute each conversation to the day it was created and to the agent responsible for it.
</Note>

## Columns

| Column                       | Type       | Description                                                                                    |
| ---------------------------- | ---------- | ---------------------------------------------------------------------------------------------- |
| `company_id`                 | Int32      | Your company (filtered automatically)                                                          |
| `agent_id`                   | Int32      | The agent                                                                                      |
| `agent_name`                 | String     | The agent's name                                                                               |
| `day`                        | Date       | The day                                                                                        |
| `chats_handled`              | UInt64     | Conversations created that day that the agent is/was responsible for                           |
| `chats_resolved`             | UInt64     | Of those, how many are finished                                                                |
| `chats_transferred_sent`     | UInt64     | Transfers the agent sent that day                                                              |
| `chats_transferred_received` | UInt64     | Transfers the agent received that day                                                          |
| `messages_sent`              | UInt64     | Messages the agent sent that day                                                               |
| `hsm_messages_sent`          | UInt64     | Of those, HSM template messages                                                                |
| `first_message_at`           | DateTime64 | Agent's first message of the day                                                               |
| `last_message_at`            | DateTime64 | Agent's last message of the day                                                                |
| `avg_first_response_sec`     | Float64    | Average seconds from a conversation's creation to the agent's first message                    |
| `avg_response_time_sec`      | Float64    | Average seconds the agent takes to reply after a customer message                              |
| `avg_resolution_min`         | Float64    | Average minutes from a conversation's creation to its resolution                               |
| `csat_avg`                   | Float64    | Average rating, considering only rated conversations                                           |
| `service_level_pct`          | Float64    | Fraction (0–1) of that day's answered conversations whose first response came within 2 minutes |
| `available_minutes`          | Int64      | Minutes the agent was in available status, derived from their status changes                   |
| `synced_at`                  | DateTime64 | When this row was last written/corrected                                                       |

## Example queries

### Team scorecard for last week

```sql theme={null}
SELECT
    agent_name,
    sum(chats_handled)                        AS chats,
    sum(chats_resolved)                       AS resolved,
    round(avg(avg_first_response_sec), 0)     AS avg_first_response_sec,
    round(avg(csat_avg), 2)                   AS csat,
    round(sum(available_minutes) / 60, 1)     AS available_hours
FROM fact_agent_daily
WHERE day >= today() - 7
GROUP BY agent_name
ORDER BY chats DESC
```

### One agent's trend over a month

```sql theme={null}
SELECT day, chats_handled, avg_first_response_sec, csat_avg
FROM fact_agent_daily
WHERE agent_id = {your_agent_id}
  AND day >= today() - 30
ORDER BY day
```
