Get analytics methods in formulas
To insert a calculated value from the Analytics Hub into a formula, use a method in the formula.
Before you begin
Role required: pa_power_user, admin
About this task
You can use a value that was calculated in the Analytics Hub as input for a formula. That value can be from any indicator, including from the current formula indicator itself.
To get a value from the Analytics Hub, insert a
method from PAFormulaUtils() into the formula. To call one of
these methods, use the Performance Analytics variable
pa. For example, to use the
PAFormulaUtils.getScore method, call
pa.getScore. For more information, see PAFormulaUtils API.
Procedure
Index indicator
- The percentage of incidents that are overdue.
- The average age of the last update of open incidents.
- The total number of open incidents.
var a = pa.getGap($[[% of open overdue incidents]], score_start) / pa.getGlobalTarget($[[% of open overdue incidents]],score_start);
var b = pa.getGap($[[Average age of last update of open incidents]], score_start) / pa.getGlobalTarget($[[Average age of last update of open incidents]], score_start);
var c = pa.getGap($[[Number of open incidents]], score_start) / pa.getGlobalTarget($[[Number of open incidents]], score_start);
var res = 100 - (100 * (a + b + c) / 3);
res;Set targets on a change itself
You want to set a target for your teams of a 10% reduction month-on-month in the incident backlog. You create a formula indicator with the following formula, and set a target of -10% for this indicator on the Analytics Hub.
var lastPeriod = new GlideDateTime(score_start.getYearUTC() + '-' + score_start.getMonthUTC() + '-01');
lastPeriod.addDaysUTC(-1);
pa.getChangePercentage($[[Number of open incidents]], lastPeriod.addDaysUTC(-1), score_start);
Filter out scores based on breakdown and element
- Obtain the unique record identifiers for the Priority breakdown and the 1 - Critical element. Breakdown records are in the Breakdown table. The location of element records varies, but is identified in the Breakdown Source
of the breakdown. In this case, the element is a Choice [sys_choice] record. For directions on how to obtain the unique record identifiers, see The unique record identifier (sys_id).
The unique record identifiers are baec0752bf130100b96dac808c0739ed for the Priority breakdown and 8a4dde73c6112278017a6a4baf547aa7 for the 1 - Critical element.
- Create an indicator with the following formula:
var res = [[Number of open incidents]]; if(pa.getCurrentBreakdownID() == 'baec0752bf130100b96dac808c0739ed' && pa.getCurrentElementID() == '8a4dde73c6112278017a6a4baf547aa7') { res = 0; } res;