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

Property Name

Required?

Description

label

No

A string that labels this calculated column, used in exports.

date_range_label

No

A string that labels the date range of the calculated column, used in exports.

type

Yes

If the subject is an event filter:

  • "first_date_in_range"
  • "last_date_in_range"
  • "total_times_in_range"\

    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"

subject

Yes

A Filter object.

Calculation object examples

"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"
    }
  }
}]
"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"
    }
  }
}]