Create a calculated field for a Data snapshots source

task australia Updated Sep 10, 2026 3 min read create-a-calculated-field.md
Raw file servicenow.com

Show the length of time that has passed between two date/time fields on a Data snapshots source table. For example, calculate Age as the difference between Created and Updated. Use this value as an aggregate field on an indicator or in a bucket group mapping.

Before you begin

Read Bucket groups and calculated fields in Data Snapshots, particularly the Limitations section.

Role required: pa_data_collector or higher

Procedure

  1. Navigate to All > Platform Analytics Administration > Breakdowns > Calculated Fields and select New.

  2. In the Name field, enter a short, descriptive name.

  3. In the Description field, provide more details about the calculated field.

  4. In the Table field, select the table to which to add the calculated field.

    The table should be used as a Data snapshots source.

  5. In the Formula field, define a DATEDIFF function.

    The DATEDIFF function has three parameters, which you specify in a comma-separated list without spaces.

    • Time unit, in the singular. Supported units are:
      • Year
      • Month
      • Week
      • Day
      • Hour
      • Minute
      • Second
    • Name of the field with the start time
    • Name of the field with the end time Important: Confirm that both the start time and end time fields are listed under Fields on the relevant Data snapshots source.

    The format follows:

    Text
    DATEDIFF('unit',start_time_field,end_time_field)

    Note: Use the technical field name, not the human-readable label. For example, use sys_created_on, not Created.

    Both the name and the formula must be unique. If either duplicates an existing calculated field, an error message is displayed and the record is not saved.

Result

If both fields in a calculated field formula are listed as dimensions of a Data snapshots source, the calculated field is listed as Eligible on that source.

Incident Age calculated field

You want to sort the indicator scores for incidents by age. There is no one field on the Incident table that tracks this. However, you determine that the difference between the Created date stamp and the Updated date stamp provides a reasonable approximation. You can filter the scores by another condition if you want the ages of only active incidents, for example.

You create a calculated field with the following values:

  • Name: Age
  • Description: The age of each incident at the time of its last update
  • Table: Incident
  • Formula: DATEDIFF('day',sys_created_on,sys_updated_on)

The formula uses the technical names of the Created and Updated fields.

[Omitted image "calculated-field-form.png"] Alt text: Completed form for incident age calculated field.

Because the Created and Updated fields are both dimensions on the incident_dataset data source, Age is listed there as an eligible calculated field.

[Omitted image "eligible-calculated-field.png"] Alt text: The Age calculated field shown in the Eligible Calculated fields related list of the incident_dataset data snapshots source record.

The Age calculated field is available to be used as an aggregate field on an indicator based on the incident_dataset source. For example, an incident indicator with the Average or Sum aggregation can use the Age field.

[Omitted image "ds-calc-field-as-aggregate.png"] Alt text: A data snapshots indicator with the incident_dataset Source using the Average aggregate on the calculated Age field.

What to do next

To use the calculated field as a filter on KPI Details, map it to a bucket group.

You cannot delete a calculated field from the Calculated Fields list.

Parent Topic:Bucket groups and calculated fields in Data Snapshots

Related topics

Data snapshots sources and collection

Keywords indicatorbreakdownperformance analytics
Search documentation
Search document titles and file paths on the australia branch