--- title: Example: Script mapping description: The Age breakdown uses the RequestedItem.Age.Days script to calculate the age of incidents in days and map the values to the RequestedItem Age Ranges bucket group. locale: en-US canonical_url: https://www.servicenow.com/docs/r/australia/now-intelligence/performance-analytics/example-script-mapping.html release: australia product: Performance Analytics classification: performance-analytics topic_type: concept last_updated: "2026-03-12" reading_time_minutes: 1 breadcrumb: [Create a breakdown mapping on a breakdown record, Automated breakdowns, Indicator breakdowns, Configure fundamentals, Performance Analytics \(Indicator data sources\), Platform Analytics] --- # Example: Script mapping The Age breakdown uses the RequestedItem.Age.Days script to calculate the age of incidents in days and map the values to the RequestedItem Age Ranges bucket group. In the first two images, you see the Age breakdown, which uses the RequestedItem.Age.Days breakdown source and the RequestedItem.Age.Days script for breakdown mapping. You also see that the breakdown source refers to the RequestedItem Age Ranges \(Days\) bucket group. \[Omitted image "age-breakdown.png"\] Alt text: The age breakdown with Requested Item.Age.Days source and mapping highlighted. \[Omitted image "incident-age-days-bkdown-source.png"\] Alt text: The Incident.Age.Days breakdown source showing the Incident Age Ranges bucket group The RequestedItem.Age.Days script takes the timestamp when the incident was opened from the incident table. The script subtracts this time from the timestamp 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. \[Omitted image "incident-age-ranges-bucket-group.png"\] Alt text: Incident Age Ranges bucket group buckets Here is the result of running this script on the Number of open incidents indicator. \[Omitted image "detailed-scorecard-age-breakdown.png"\] Alt text: KPI Details for the Number of open incidents indicator showing the Age breakdown. **Parent Topic:**[Create a breakdown mapping on a breakdown record](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/now-intelligence/performance-analytics/t_CrtBkdnBreakdownMpngs.md) **Related topics** [Scripting in Performance Analytics](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/now-intelligence/performance-analytics/pa-scripts.md)