A KPI can be built from one or more KPIs. Calculating a KPI from another KPI offers an opportunity to reuse existing calculations and to access the history of a KPI value, which opens up interesting possibilities for broader aggregations, statistical functions and even prediction.
For example, perhaps you are tracking a KPI for the daily budget spent. This KPI has been calculated from a time reporting metric or inferred from a workflow management tool such as JIRA. We can reuse this KPI for daily budget spent to calculate a new KPI for the total budget spent and we can reuse this new KPI to build yet another KPI that predicts the total budget spent at the end of the month.
Daily budget spent:
On lines 1-3 get the latest values for three different time metrics.
On lines 5-7 convert time to money using different rates for each metric value
On line 9 return the total budget spent by summing all three components.
Total budget spent:
On line 1 the special ServiceClarity variable now is used to define a range of dates, from the start of the month until the current date.
On line 2 the ServiceClarity variable kpis is used to get the existing KPI: daily budget spent and then filter the to data to include only dates in our date range.
On line 3 the aggregate function sum is applied and the value of the KPI is returned as the total budget spent in the month to date
Predicted end of month spend:
On line 1 get the kpi for total budget spent calculated in the previous steps.
On line 2 use the ServiceClarity variable now to define a date range that covers the last 10 days.
On line 3 use the last 10 days and the KPI budget values to predict how the budget will evolve over the coming days
On line 5 use the prediction to calculate the expected budget on the last day of the month and return this as the value for our new predicted end of month spend KPI