---
sourceDocument: Zurich Platform Analytics
sourceDocumentLink: https://www.servicenow.com/docs/r/zurich/now-intelligence

 Release :

    - zurich

ft:locale :

    - en-US

ft:publication_title :

    - Zurich Platform Analytics

ft:clusterId :

    - par

bundleId :

    - par

workflow :

    - Platform


---

# Example: Script mapping

# Example: Script mapping {#ariaid-title1}

* Release version: Zurich
* 
* Updated July 31, 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

The Age breakdown uses the Incident.Age.Days script to calculate the age of incidents
in days and map the values to the Incident Age Ranges bucket group.  
In the first two images, you see the Age breakdown, which uses the Incident.Age.Days breakdown source and the Incident.Age.Days script for breakdown mapping. You also see that the breakdown source refers to the Incident Age
Range (Days) bucket group.  

<br />

<br />

<br />

The Incident.Age.Days script takes the time stamp when the incident was opened from the incident table and subtracts this from the time stamp at the end of the collection period. The script converts this value from milliseconds
to days.

    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);

The resulting numbers of days are sorted into the buckets of the bucket group.

Here is the result of running this script on the Number of open incidents indicator.

**Related concepts**   

* [Scripting in Performance Analytics](https://www.servicenow.com/docs/b3Yupayhbbp2nLa519_5mA#pa-scripts "Performance Analytics provides several script objects for use in scripts and APIs for querying Performance Analytics data. The scripts serve as breakdown mappings or to calculate a value from an indicator.")

