# BMC Helix Remedyforce - How to Calculate the Age of an Incident and Report on these Values.

Version 6

This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.

PRODUCT:

## PROBLEM:

How to show the age of an incident and group incidents based on age? IE: open 0-1 days, 2-5 days, 5-10 days, etc.

## SOLUTION:

As a SalesForce administrator create two new custom fields on the incident object. The first field will calculate the number of days the incident has been, or was open.  The second field then writes text based on a series of nested if() statements.

Creating the Incident Age field:

1. Select Setup | App Setup | Create | Objects | Incident Object

2. Select | Custom Fields & Relationships | Select New | Formula:

•  Field name = Days Open
•
•  Formula return type = Number with 0 decimal places
•
•  Select Next

In the "Simple Formula" tab copy and paste the below formula:

if( BMCServiceDesk__state__c = True, datevalue(now()) - datevalue(CreatedDate),  datevalue( BMCServiceDesk__closeDateTime__c) - datevalue(CreatedDate) )

3. Click Verify Syntax | Click Next.

4. Click Save | New button

Displaying Text Information Based on the Period Evaluation

5. In the new field dialog that resulted from the "Save and New" option above:

6. Select Formula:

•   Field name = Grouped by Days Open
•
•   Formula return type = Text
•
•   Select Next

In Simple Formula tab copy and paste the below formula:

if(Days_Open__c<=1,"0-1 Days",

(if(Days_Open__c>1 && Days_Open__c<=5,"2-5 Days",

(if(Days_Open__c>5 && Days_Open__c<=10,"5-10 Days",

(if(Days_Open__c>10 && Days_Open__c<=30,"10-30 Days",

"More than 30 Days")

))

))

))

** The above could be modified to use alternate values, or additional evaluation lines.

7. Click Verify Syntax | Click Next.

8. Select Save.

NOTE: Now that the data exists for each incident,  create a report to show this data and group by the "Grouped by Days Open" Field.

Create the Report to Shows Incidents grouped by Days:

1. From SFDC Click Setup | Click + (All Tabs) | Click Reports | Click New Report

2. In Quick Find | Click Incident | Click Incidents | Click Create.

3. Drag and drop "Days open" and "Grouped by Days Open" onto report.

4. Group by "Grouped by Days Open" column

6. Verify the report returns the Age and Days open as desired.

Article Number:

## 000007426

Article Type:

## Solutions to a Product Problem

Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles