Product documentation Docs
    • English
    • Deutsch
    • 日本語
    • 한국어
    • Français
  • More Sites
    • Now Community
    • Developer Site
    • Knowledge Base
    • Product Information
    • ServiceNow.com
    • Training
    • Customer Success Center
    • ServiceNow Support Videos
  • Log in

Product documentation

  • Home
How search works:
  • Punctuation and capital letters are ignored
  • Special characters like underscores (_) are removed
  • Known synonyms are applied
  • The most relevant topics (based on weighting and matching to search terms) are listed first in search results
Topics are ranked in search results by how closely they match your search terms
  • A match on the entire phrase you typed
  • A match on part of the phrase you typed
  • A match on ALL of the terms in the phrase you typed
  • A match on ANY of the terms in the phrase you typed

Note: Matches in titles are always highly ranked.

  • Release version
    Table of Contents
    • Analytics, Intelligence, and Reporting
Table of Contents
Choose your release version
    Home London Analytics, Intelligence, and Reporting Analytics, Intelligence, and Reporting Performance Analytics Performance Analytics data architecture Performance Analytics breakdowns Bucket groups

    Bucket groups

    • Save as PDF Selected topic Topic & subtopics All topics in contents
    • Unsubscribe Log in to subscribe to topics and get notified when content changes.
    • Share this page

    Bucket groups

    are used to recategorize data so it can be used as a breakdown, for example by grouping a range of values into discrete buckets.

    In the data architecture, bucket groups are defined in Bucket Group [pa_bucket_groups] records and buckets in Bucket [pa_buckets] records. Each Bucket [pa_buckets] record contains a Bucket Group field that is a reference to a Bucket Group [pa_bucket_groups] record.

    To work with a bucket group, create a breakdown source that uses Bucket [pa_buckets] as the facts table and specifies the bucket group in a condition. If a breakdown built on this source uses a breakdown mapping with a script, the breakdown groups the values that the script returns into buckets. If the breakdown mapping specifies a field instead of using a script, the breakdown groups the values of the mapped field into buckets.

    Related tasks
    • Create a breakdown mapping on a breakdown record

    Grouping field values into buckets

    You can use a bucket group with a breakdown mapping that does not use a script, to group the values of any mapped field to buckets.

    The use case can be as simple as translating the true and false values of a Boolean into two buckets with meaningful labels.

    Example: Sorting Boolean values into buckets

    A base Performance Analytics installation includes the Active breakdown as part of the Analytics Usage Overview. This breakdown uses a mapping to the job.active Boolean field from the Job Log [pa_jobs_logs] table. The breakdown source uses a bucket group where true values for job.active are sorted into the Active bucket, while false values are sorted into the Inactive bucket. Note that false values are numerically considered to be a value less than one, while true values are numerically one and above.

    Bucket group form showing the Inactive and Active buckets and their ranges

    Grouping script results into buckets

    When you have a breakdown mapping script that collects a range of values, you can define a bucket group to divide those values into discrete buckets.

    After you create the bucket group, you create a breakdown source based on the bucket group. Then you create a breakdown that uses that breakdown source. When you create the breakdown mapping for the breakdown, define or select a script for the mapping. The breakdown groups the results that the script returns into the buckets of the bucket group. For an example, see Example: Script mapping.

    You can write a bucket group for an existing script, or you can first write 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

    Specify a group of buckets into which you want to recategorize data.

    Before you begin

    Role required: pa_data_collector or admin

    Procedure

    1. Navigate to Breakdowns > 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: 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. This script 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

    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.
    Related tasks
    • Example: Script mapping
    Related concepts
    • Scripting in Performance Analytics

    Tags:

    Feedback
    On this page

    Previous topic

    Next topic

    • Contact Us
    • Careers
    • Terms of Use
    • Privacy Statement
    • Sitemap
    • © ServiceNow. All rights reserved.

    Release version
    Choose your release version

      Bucket groups

      • Save as PDF Selected topic Topic & subtopics All topics in contents
      • Unsubscribe Log in to subscribe to topics and get notified when content changes.
      • Share this page

      Bucket groups

      are used to recategorize data so it can be used as a breakdown, for example by grouping a range of values into discrete buckets.

      In the data architecture, bucket groups are defined in Bucket Group [pa_bucket_groups] records and buckets in Bucket [pa_buckets] records. Each Bucket [pa_buckets] record contains a Bucket Group field that is a reference to a Bucket Group [pa_bucket_groups] record.

      To work with a bucket group, create a breakdown source that uses Bucket [pa_buckets] as the facts table and specifies the bucket group in a condition. If a breakdown built on this source uses a breakdown mapping with a script, the breakdown groups the values that the script returns into buckets. If the breakdown mapping specifies a field instead of using a script, the breakdown groups the values of the mapped field into buckets.

      Related tasks
      • Create a breakdown mapping on a breakdown record

      Grouping field values into buckets

      You can use a bucket group with a breakdown mapping that does not use a script, to group the values of any mapped field to buckets.

      The use case can be as simple as translating the true and false values of a Boolean into two buckets with meaningful labels.

      Example: Sorting Boolean values into buckets

      A base Performance Analytics installation includes the Active breakdown as part of the Analytics Usage Overview. This breakdown uses a mapping to the job.active Boolean field from the Job Log [pa_jobs_logs] table. The breakdown source uses a bucket group where true values for job.active are sorted into the Active bucket, while false values are sorted into the Inactive bucket. Note that false values are numerically considered to be a value less than one, while true values are numerically one and above.

      Bucket group form showing the Inactive and Active buckets and their ranges

      Grouping script results into buckets

      When you have a breakdown mapping script that collects a range of values, you can define a bucket group to divide those values into discrete buckets.

      After you create the bucket group, you create a breakdown source based on the bucket group. Then you create a breakdown that uses that breakdown source. When you create the breakdown mapping for the breakdown, define or select a script for the mapping. The breakdown groups the results that the script returns into the buckets of the bucket group. For an example, see Example: Script mapping.

      You can write a bucket group for an existing script, or you can first write 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

      Specify a group of buckets into which you want to recategorize data.

      Before you begin

      Role required: pa_data_collector or admin

      Procedure

      1. Navigate to Breakdowns > 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: 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. This script 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

      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.
      Related tasks
      • Example: Script mapping
      Related concepts
      • Scripting in Performance Analytics

      Tags:

      Feedback

          Share this page

          Got it! Feel free to add a comment
          To share your product suggestions, visit the Idea Portal.
          Please let us know how to improve this content

          Check any that apply

          To share your product suggestions, visit the Idea Portal.
          Confirm

          We were unable to find "Coaching" in Jakarta. Would you like to search instead?

          No Yes
          • Contact Us
          • Careers
          • Terms of Use
          • Privacy Statement
          • Sitemap
          • © ServiceNow. All rights reserved.

          Subscribe Subscribed Unsubscribe Last updated: Tags: January February March April May June July August September October November December No Results Found Versions Search preferences successfully updated My release version successfully updated My release version successfully deleted An error has occurred. Please try again later. You have been unsubscribed from all topics. You are now subscribed to and will receive notifications if any changes are made to this page. You have been unsubscribed from this content Thank you for your feedback. Form temporarily unavailable. Please try again or contact  docfeedback@servicenow.com  to submit your comments. The topic you requested does not exist in the release. You were redirected to a related topic instead. The available release versions for this topic are listed There is no specific version for this documentation. Explore products Click to go to the page. Release notes and upgrades Click to open the dropdown menu. Delete Remove No selected version Reset This field is required You are already subscribed to this topic Attach screenshot The file you uploaded exceeds the allowed file size of 20MB. Please try again with a smaller file. Please complete the reCAPTCHA step to attach a screenshot
          Log in to personalize your search results and subscribe to topics
          No, thanks Login