---
updatedAt: 2025-03-06T23:50:24.000Z
agentTools:
  projectIndex: https://docs.affluent.io/llms.txt
---

# Custom Metrics

Using the Reports endpoint, you can replicate the custom metric feature in the Affluent UI by passing an object as a metric as oppose to a metric name.

You will need the following fields:

* **alias**: Specify the name you want to give the custom metric (this is how it will be labelled in the response).  Note, it must start with the prefix `custom_`.
* **aggregation**: Specify how you want to aggregate your metric(s). All the possible values are\
  `[ SUM, MAX, AVG, MIN ]`
* **calculation**: An object containing your **operator** and your **operands**.

Note, the possible operator values are `+`, `-`, `*`, and `/`.

Here's an example of how you could request a custom metric that represents the Net number of Actions driven by New Customers:

```json
"metrics": [
    {
      "alias": "custom_new_actions", // prefix `custom_` is required!
      "aggregation": "SUM",
      "calculation": {
        "operator": "+",
        "operands": [
          {
            "metric": "actionCountNet",
            "filters": {
              "operator": "AND",
              "statements": [
                {
                  "category": "repeatCustomer",
                  "match": "equals",
                  "values": [
                    "FALSE"
                  ]
                }
              ]
            }
          }
        ]
      }
    }
  ]
```