Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Bucket groups

A bucket group is used to create a special breakdown source that you can use with a scripted breakdown. A bucket group divides the range of values that the script returns into discrete buckets. The breakdown sorts records into these buckets.

A bucket group is paired with a script. When you have a script that collects a range of values, you can define a bucket group to divide those values into discrete buckets. Create a breakdown source based on the bucket group. Then you create a breakdown that uses that breakdown source and is mapped to the script. The breakdown uses the script to sort records into the buckets. For example, you have a script that calculates the age of records in the incident table and a bucket group that divides those ages into <1 day, 2–5 day, 6–30 day, and 30+ day buckets. If you have a breakdown that uses this bucket group and script, and you use this breakdown with the 'Number of open incidents' indicator, currently open incidents are sorted into these age buckets.

You can write a bucket group for an existing script, or you can create the bucket group and then write the script. Both must exist before you can create the breakdown.

Note: The same script can be used with any number of bucket groups. Also, in principle any scripts that returned the same kind of data could be used with the same bucket group.

Create a bucket group

Define the ranges of values that you want to group into buckets.

Before you begin

Role required: pa_data_collector or admin

Procedure

  1. Navigate to Performance Analytics > Data Collector > Bucket Groups.
  2. Click New.
  3. Enter a Name that clearly identifies the bucket group, like Age Ranges in Days.
  4. Double-click Insert a new row to add a new bucket.
  5. Enter a Name for the first bucket, then press Enter or click the green check icon.
  6. Double-click in the Start and End columns to enter the starting and ending values for the range.
    Records that match the end value are excluded from the bucket. Therefore, set the end value of one bucket and the start value of the next bucket to be the same. Records that exactly match that value are sorted into the bucket that has that value as the start value.
  7. Click Submit after all the bucket ranges have been defined.

Example

Figure 1. Incident Age Ranges bucket group
Consider the case where you want to group incidents by age, as follows:
  • Less than a day
  • 1-5 days
  • 6-30 days
  • 30-90 days
  • More than 90 days
In Performance Analytics > Scripts, you already have a script named Incident.Age.Days that derives the age in days of an incident from its opening date and the latest date on which a score was collected:
var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var days=function(x,y){return diff(x,y)/(24*60*60*1000);};
days(current.opened_at, score_end);

You create a new bucket group named Incident Age Ranges (Days). In this bucket group, you define a set of buckets that start at the desired date and end at the beginning of the next bucket. For example, the 06-30 Days bucket starts at 6 and ends at 31:The 06-30 day bucket

This bucket will contain incidents from the age of precisely 6 days to the age of 30 days, 23 hours, 59 minutes, and 59 seconds.

At the end, you have a bucket group with five buckets corresponding to the age ranges in which you want to divide incidents.

Bucket groups

The Script Mapping example shows a breakdown that uses this bucket group and script.

What to do next

Create a breakdown source that uses the Bucket [pa_buckets] facts table, the Sys ID field, and the condition [Bucket group][Is][<the name of the bucket group you created>]. Then create a breakdown that uses this breakdown source and uses the relevant script for the breakdown mapping.