---
updatedAt: 2025-06-17T21:45:14.000Z
agentTools:
  projectIndex: https://support.kissmetrics.io/llms.txt
---

# Calculations

Calculations are used in People Search queries to add columns to the results. For example, you can add a column that calculates the "last KM Browser over the last 7 days".

### Calculation object properties

<Table align={["left","left","left"]}>
  <thead>
    <tr>
      <th style={{ textAlign: "left" }}>
        Property Name
      </th>

      <th style={{ textAlign: "left" }}>
        Required?
      </th>

      <th style={{ textAlign: "left" }}>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td style={{ textAlign: "left" }}>
        `label`
      </td>

      <td style={{ textAlign: "left" }}>
        No
      </td>

      <td style={{ textAlign: "left" }}>
        A string that labels this calculated column, used in exports.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>

      </td>

      <td style={{ textAlign: "left" }}>

      </td>

      <td style={{ textAlign: "left" }}>

      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `date_range_label`
      </td>

      <td style={{ textAlign: "left" }}>
        No
      </td>

      <td style={{ textAlign: "left" }}>
        A string that labels the date range of the calculated column, used in exports.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>

      </td>

      <td style={{ textAlign: "left" }}>

      </td>

      <td style={{ textAlign: "left" }}>

      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `type`
      </td>

      <td style={{ textAlign: "left" }}>
        Yes
      </td>

      <td style={{ textAlign: "left" }}>
        If the `subject` is an event filter:

        * `"first_date_in_range"`
        * `"last_date_in_range"`
        * `"total_times_in_range"`\ <br />\
          If the `subject` is a property filter:
        * `"first_date_in_range"`
        * `"last_date_in_range"`
        * `"first_value_in_range"`
        * `"last_value_in_range"`
        * `"total_value_in_range"`
        * `"min_value_in_range"`
        * `"max_value_in_range"`
        * `"avg_value_in_range"`
        * `"median_value_in_range"`
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>

      </td>

      <td style={{ textAlign: "left" }}>

      </td>

      <td style={{ textAlign: "left" }}>

      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>
        `subject`
      </td>

      <td style={{ textAlign: "left" }}>
        Yes
      </td>

      <td style={{ textAlign: "left" }}>
        A [Filter](#property-filters) object.   

        * *Note:\*\**&#x54;he REST API does not currently support the passing of [Logical Operator Filters](#logical-operators) as a `subject`.
      </td>
    </tr>

    <tr>
      <td style={{ textAlign: "left" }}>

      </td>

      <td style={{ textAlign: "left" }}>

      </td>

      <td style={{ textAlign: "left" }}>

      </td>
    </tr>
  </tbody>
</Table>

### Calculation object examples

```json Add a column for the "last KM Browser over the last 7 days"
"calculations": [{
  "type": "last_value_in_range",
  "label": "KM Browser",
  "date_range_label": "Last 7 days",
  "subject": {
    "negate": false,
    "type": "property",
    "comparison_mode": "any_value",
    "property": 755,
    "date_range": {
      "type": "preset",
      "preset": "today"
    }
  }
}]
```

```json Add a column for the "total times they did Visited Site today"
"calculations": [{
  "type": "total_times_in_range",
  "label": "Site Visits",
  "date_range_label": "Today",
  "subject": {
    "negate": false,
    "type": "event",
    "event": 1,
    "date_range": {
      "type": "preset",
      "preset": "today"
    }
  }
}]
```