In many situations the latest value for a metric on a given day is typically the most useful value but there are other possibilities. 

Imagine that we are running an online gaming service and we have a data source that can tell us the number of players actively using our service at this moment. We can create an active users metric to track this value every ten minutes. Two KPIs that might be if interest are the average number of users and the maximum number of users

  • On line 1 the ServiceClarity variable metrics is used to get the metric: active users.
  • On line 3 the aggregate function average is applied and the value of the KPI is returned as the average number of active users.
  • On line 1 the ServiceClarity variable metrics is used to get the metric: active users.
  • On line 3 the aggregate function maximum is applied and the value of the KPI is returned as the average number of active users.

ServiceClarity provides a range of aggregation functions that can be applied to metrics and other KPIs:

Latest

var latest = metrics.get('active users').latest() 

Average

var average = metrics.get('active users').average() 

Maximum

var max = metrics.get('active users').maximum() 

Minium

var min = metrics.get('active users').minimum() 

Earliest

var first = metrics.get('active users').earliest() 

Median

var median = metrics.get('active users').median() 

Sum

var total = metrics.get('active users').sum() 

Did this answer your question?