# How to calculate the Handover Rate
## Symptoms

How to calculate the Handover Rate — the transfer coefficient, ticket 'soccer' index?

## Solution

### Option 1

You can look directly at how many Responsible parties there were on average in a ticket, which will be a rough indicator of how many times the ticket was transferred. The limitation is that when Agent A <> Agent B pass between themselves. But this is quite a rare case, so the average number of Responsible parties should be quite sufficient for large datasets.

### Option 2

1. Create a new custom field of type Integer in **Settings > Custom Fields**:

![](https://support.swarmica.com/attachments/A/u/AuboSfI_mOeQuqZc_a/image.png)

And copy its UID from the URL.

2. Go to **Settings** and into **Macros** and create a new one where:
**ID Object**: {{ event.ticket.id }}
**Data**:

```json
{
  "custom_fields": [
    {
      "uid": "EY1pPecadgSmZnuC",
      "value": "{% set count = event.ticket.custom_fields.get_value('WRITE THE CUSTOM FIELD ID HERE') %}{% if count is not none %}{{ count + 1 }}{% else %}0{% endif %}"
    }
  ]
}
```

3. In **Settings** - **Event Actions** create a new one where the event is Assignee Changed and select the macro from step 2

![](https://support.swarmica.com/attachments/p/v/pvMNXElCpZVKag5Z_a/image.png)

Then you can use this custom field to create filters and summary reports.

:::danger
With a large amount of data, the macro's operation may need additional tuning, so for more stable and universal application, option 3 with the script is recommended. See below
:::



### Option 3

Instead of a macro, use a script.

1. Create a new custom field of type Integer in **Settings > Custom Fields**:

![](https://support.swarmica.com/attachments/A/u/AuboSfI_mOeQuqZc_a/image.png)

And copy its UID from the URL.

2. Create a new script in **Settings > Scripts** and upload the [example script](https://support.swarmica.com/attachments/1/x/1xIZGNGxyv849Msu_a/trigger_update_assigned_count.py)

3. In **Settings** - **Event Actions** create a new one where the event is Assignee Changed and select the script from step 2

![](https://support.swarmica.com/attachments/p/v/pvMNXElCpZVKag5Z_a/image.png)

4. In the '**Add data to context**' field, enter the following:

```json
{
   "cf_uid": "CUSTOM FIELD UID WHERE TO WRITE THE VALUE"
}

```

Save and run the action.

Then you can use this custom field to create filters and summary reports.