

# Getting started with calculated attributes in Amazon Connect Customer Profiles
Getting started with calculated attributes

Use calculated attributes to define your own business logic to transform your customer profile data into actionable data points to personalize automated experiences, such as interactive voice responses.

By using calculated attributes, you can identify key attributes about your customer’s past behavior, behavior patterns, and customer value.

The topics in this section show you how to create, view, edit, and delete Calculated Attributes.

**Topics**
+ [Create calculated attributes](calculated-attributes-admin-website-create.md)
+ [Set up event filters](calculated-attributes-admin-website-event-filters.md)
+ [View calculated attributes](calculated-attributes-admin-website-view.md)
+ [Edit calculated attributes](calculated-attributes-admin-website-edit.md)
+ [Delete calculated attributes](calculated-attributes-admin-website-delete.md)

# Create calculated attributes in Amazon Connect
Create calculated attributes

1. Prerequisites: Ensure you have the necessary security profile permissions. For more information, see [Update permissions for calculated attributes in Amazon Connect Customer Profiles](security-profile-customer-profile-calc-attribs.md).

1. In Amazon Connect admin website, navigate to **Customer Profiles**, **Calculated attributes**, choose **Create attribute** in the **Calculated attributes** table view.  
![\[The Customer profiles tab in the agent workspace, the Associate button.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/calculated-attributes-admin-website-create-1.png)

1. To create a calculated attribute, assign a descriptive name, add description (optional) with details about the attribute, and configure the required fields:
   + **Calculation:** Defines how attributes are computed (average/count/sum/minimum/first occurrence/last occurrence/max occurrence).
   + **Attribute:** A data point from your customer profiles data.
**Note**  
If you are selecting an attribute from a standard object type (`_asset`, `_case`, `_order`), the attributes must be in PascalCase. This means that the first letter of each word in the attribute name is capitalized, such as `_case.CreatedBy` or `_order.TotalPrice`.  
![\[The Customer profiles tab in the agent workspace, the Associate button.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/calculated-attributes-admin-website-create-2.png)

1. Additionally, you can add another attribute by selecting the *plus* icon. You can choose up to two attributes to calculate and combine them by an operator. Specify an operator such as *plus* or *minus* to combine the attribute values.  
![\[The Customer profiles tab in the agent workspace, the Associate button.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/calculated-attributes-admin-website-create-3.png)

1. Once the calculation is selected, you can optionally configure the Number of events, Time period, and Source timestamp. By default, calculated attributes is configured to use unlimited events, an unlimited time period, and a timestamp based on ingestion date.

   An output is returned when there is at least one event during the specified time period.
   + **Number of events:** configure limit or use unlimited (default)
   + **Time period:** set specific timeframe or use unlimited (default)
   + **Source timestamp:** choose between a specific timestamp field or ingestion date (default)
**Note**  
While there's no event limit, a data size limit exists where oldest data will be replaced by newer data. Source timestamp cannot be changed after creation.  
![\[The Customer profiles tab in the agent workspace, the Associate button.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/calculated-attributes-admin-website-create-4.png)

1. Optionally, you can define criteria to include only relevant events in calculations. See [Set up event filters](calculated-attributes-admin-website-event-filters.md) for more information.

1. Select **Create** to create the calculated attribute.

1. After a calculated attribute has been created successfully, a banner is displayed on the table view for using the calculated attribute in a segment or flow. You will also be able to view the status of calculated attributes based on the readiness.  
![\[A banner that the calculated attribute has been created.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/calculated-attributes-admin-website-create-5.png)

# Set up event filters
Set up event filters

Event filters allow you to filter the profile objects to be used in the calculated attribute. For example, an event filter might filter the customer's standard asset objects so that only the assets with **Status is Installed OR Registered** are included in the calculation.

**Note**  
You cannot edit event filters after creating a calculated attribute definition.

When you create a calculated attribute, you can create one or more event filters. An event filter consists of the following components:

![\[Event filter components.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/calculated-attributes-admin-website-event-filters-1.png)

+  **Filter groups**: Group of filters that you apply to the profile objects. You can add multiple filter groups which are connected by OR relationships. 
+  **Filters**: Filters the profile objects that are included in the calculation of the calculated attribute by specifying attributes, operators, and values. You can add as many filters as needed for your use case. 
+  **Attribute**: The attribute of the object to filter by. You can select attributes from objects stored in the Customer Profiles domain or use the field names defined in the object type definition. for more information about object type mappings, see [Object type mapping definition details in Amazon Connect Customer Profiles](object-type-mapping-definition-details.md).
**Note**  
 In Amazon Connect admin website, the attribute dropdown shows the timestamp of the last time any profile object was saved or updated with the attribute. 
 If there is both an attribute of a profile object and a field of an object type with the same name, the event filter prioritizes the object type field name in its filtering. For example, if a profile object has an attribute named **Status** and there is also an object type field named **Status**, the filter will use the object type field **Status** for filtering. 
+  **Operator** — The operator determines the relationship of the attribute to a value you enter. For more information, see [Filter operators](#calculated-attributes-admin-website-event-filter-operators)
+  **Value** — The value to filter objects with. You can specify multiple values connected by OR relationships. For example, *Asset's Status is Installed or Registered*. Note that values are case-sensitive. For example, *Asset's Status is Installed* returns different results than *Asset's Status is installed*. To view profile objects, use the Amazon Connect Customer Profiles [ListProfileObjects](https://docs.aws.amazon.com/connect/latest/APIReference/API_connect-customer-profiles_ListProfileObjects.html) API.

 You can optionally create up to two event filters and create a relationship (AND/OR/EXCLUDE) between them. For more details about the relationship, see [Relationship between event filters](#calculated-attributes-admin-website-relationship-between-event-filters). 

 

## Filter operators
Filter operators

Operators determine the relationship of the attribute to a value you enter. The following table describes the available operators.

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/connect/latest/adminguide/calculated-attributes-admin-website-event-filters.html)

**Note**  
 Calculated attributes in the Amazon Connect admin website use the UTC timezone and a default time of 00:00:00 UTC for all time-based filters. You can filter on dates but times are recorded as the same value. If you enter a date of 2024-01-01, the console passes the time as 2024-01-01T00:00:00Z. 

**Note**  
By default, event filters are evaluated when a profile object is saved or updated. For instance, if you filter standard asset objects where the `PurchaseDate` is within the last week, the relative time is calculated as *within the last week from the moment the asset object is saved or updated*. This means the filtering results may vary depending on when the object is saved or updated.

## Relationship between event filters
Relationship between event filters

 Optionally, you can add the second event filter and define a relationship with the first event filter. When you create a calculated attribute in the Amazon Connect admin website, you can have a maximum of two event filters per calculated attribute. If you add the second event filter to your calculated attribute, you can choose one of two ways to specify how the two event filters are connected: 
+  **AND relationship** — If you use the AND relationship to connect two event filters, objects that meets both the first and second event filter, will be included in the calculation. 
+  **OR relationship** — If you use the OR relationship to connect two event filters, objects that meets either the first or second event filter, will be included in the calculation. 
+  **EXCLUDE relationship** — If you use the EXCLUDE relationship to connect two event filters, objects that meets the first event filter but does not meet the second event filter, will be included in the calculation. 

## Next steps
Next steps
+  [Use your calculated attribute in your contact center via the Flow editor](https://docs.aws.amazon.com/connect/latest/adminguide/customer-profiles-block.html#customer-profiles-block-properties-get-calculated-attributes) 
+  [Use your calculated attribute to define a customer segment](https://docs.aws.amazon.com/connect/latest/adminguide/segmentation-admin-website)
+  [View Calculated Attributes in Amazon Connect](https://docs.aws.amazon.com/connect/latest/adminguide/calculated-attributes-admin-website-view.html) 
+  [Edit Calculated Attributes in Amazon Connect](https://docs.aws.amazon.com/connect/latest/adminguide/calculated-attributes-admin-website-edit.html) 
+  [Delete Calculated Attributes in Amazon Connect](https://docs.aws.amazon.com/connect/latest/adminguide/calculated-attributes-admin-website-delete.html) 

# View calculated attributes in Amazon Connect
View calculated attributes

1. Log in to the Amazon Connect admin website at https://*instance name*.my.connect.aws/. Use an Admin account, or an account assigned to a security profile that has **Customer Profiles - Calculated Attributes** permission. permission. 

1. In Amazon Connect, on the left navigation pane, choose **Customer Profiles**, **Calculated attributes**.

1. On the **Calculated attributes** page, choose a calculated attribute from the **Name** column in the table. 

   The following image shows an example of calculated attributes listed in the **Name** column.  
![\[A table that lists calculated attributes.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/calculated-attributes-admin-website-view-1.png)

1. You can now view the details of the attribute that you selected. The following image shows a page of details for a calculated attribute.  
![\[Detailed view of a calculated attribute.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/calculated-attributes-admin-website-view-2.png)

# Edit calculated attributes in Amazon Connect
Edit calculated attributes

1. To edit a calculated attribute, choose an attribute in the table view by selecting the radio button, which enables the **Edit** button. Choose **Edit**.  
![\[edit a calculated attribute\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/calculated-attributes-admin-website-edit-1.png)

1. You can edit the **Description**, **Number of events**, and **Time period**. When done, choose **Save**.  
![\[Edit a calculated attribute.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/calculated-attributes-admin-website-edit-2.png)

# Delete calculated attributes in Amazon Connect
Delete calculated attributes

1. To delete a calculated attribute, choose an attribute in the table by selecting the radio button next to the attribute that you would like to delete.

1. Once selected, choose **Delete**.

1. In the **Delete Attribute** pop-up, verify the details and enter *confirm* to enable the **Delete** button.  
![\[Delete a calculated attribute.\]](http://docs.aws.amazon.com/connect/latest/adminguide/images/calculated-attributes-admin-website-delete-1.png)

1. Choose **Delete**.