

# Query your data in manager assist

Some questions go beyond what a metric can answer. For example, you might want the specific contacts that met a set of conditions, a breakdown by a field that isn't a metric dimension, or contacts together with their evaluations. For these questions, manager assist queries your contact center data directly, runs the query for you, and returns the results in the chat. You describe what you want in plain language. You don't need to know how the data is organized or write SQL.

## When manager assist queries your data
<a name="manager-assist-query-data-when"></a>

Manager assist chooses the data source for you. It uses metrics when a standard or custom metric answers the question. It queries the Amazon Connect Data lake when it needs individual records, or fields that metrics don't include. For more information, see [Data lake](data-lake.md).


| Metrics answer questions about | Data queries answer questions about | 
| --- | --- | 
| Totals, averages, and rates, such as service level or average handle time | Lists of specific contacts that meet the conditions you describe | 
| Trends and comparisons across queues, agents, and time periods | Fields that aren't metric dimensions, such as contact attributes | 
| Rankings and leaderboards | Data from more than one area, such as contacts together with their evaluation scores | 

## Example questions
<a name="manager-assist-query-data-examples"></a>


| Goal | Example question | 
| --- | --- | 
| Find contacts that match conditions | **Show me contacts that were transferred more than twice yesterday.** | 
| Combine contacts and evaluations | **Which contacts had evaluation scores under 60 last week? Include the form used and who evaluated them.** | 
| See who handled a set of contacts | **Show me contacts that were transferred yesterday, who handled them, and their evaluation scores.** | 
| Find repeat contacts | **Show me this month's inbound contacts that were follow-ups to an earlier contact, broken down by category.** | 
| Group by any field | **Break down yesterday's abandoned contacts by initiation method.** | 
| Break down a measure by a field | **Break down yesterday's contacts by disconnect reason, with agent interaction time.** | 
| Group by more than one field | **Break down yesterday's contacts by initiation method and channel.** | 
| Compare groups of contacts | **Compare average time in queue last month for contacts that were transferred and contacts that weren't.** | 

![Manager assist answers Break down this week's contacts by queue and initiation method from the contact records with a total, a table of contacts by queue and initiation method, a summary, and follow-up prompts.](https://docs.aws.amazon.com/connect/latest/adminguide/images/manager-assistant-query-data-breakdown.png)


## Data you can query
<a name="manager-assist-query-data-sources"></a>

Manager assist can query the following data.


| Data | Examples of what you can ask about | 
| --- | --- | 
| Contact records | Channel, queue, agent, initiation method, start and end times, whether the contact was transferred, time in queue, agent interaction time, and after-contact work time | 
| Agent activity by queue | Contacts offered to each agent and contacts that the agent didn't respond to, by queue and time interval | 
| Agent names | First and last names of agents, shown with their contacts and activity | 
| Related data | Contact evaluations, cases, flows, bot sessions, and custom contact attributes, shown together with the contacts and agents they relate to | 
| Workforce management | Staffing groups, schedules, shift rotations, and demand and forecast groups | 

Your detailed data is usually available for queries less than an hour after a contact ends. For the most recent activity, ask about real-time metrics instead.

## How results appear
<a name="manager-assist-query-data-results"></a>
+ Results appear as a table in the chat. You can ask for a chart instead. For more information, see [Visualizations](manager-assist-visualizations.md).
+ The response describes what manager assist looked for, such as the time range and conditions, so you can check that it matches your question.
+ A list of records shows up to 25 rows in one answer. If more records match, the answer says so, and you can ask for the next rows or for a count.
+ If nothing matches, the answer says that no records you can view matched in that time range. It doesn't treat an empty result as an error.

## Access to data
<a name="manager-assist-query-data-access"></a>

**Important**  
Data queries apply the access controls in your security profile, including tag-based access control and agent hierarchy restrictions. Manager assist returns only records for the resources that you have permission to view. If manager assist can't apply one of your restrictions to a type of data, it returns an error instead of the data.

## Quotas
<a name="manager-assist-query-data-limits"></a>


| Limit | Value | 
| --- | --- | 
| Rows returned in the chat | 25 | 
| Time range for a single query | 35 days | 
| Historical data available | 2 years | 
| Query timeout | 30 seconds | 

If a question needs more data than these limits allow, narrow the time range or add conditions.

## Validate results
<a name="manager-assist-query-data-validate"></a>
+ Check that the time range and conditions in the response match what you meant.
+ For decisions with significant operational impact, confirm the results with a report or your own query.
+ If a response leaves out something that you expected, ask manager assist which data it used.