What we will cover:

  • How to create a Completed Time Spent on Stories KPI
  • How to Filter Time Spent into Assignee, Sprint, Priority etc.   

Great question! To gain this insight, we will need to build the “Completed Time Spent on Stories” KPI.

Here are the Prerequisites for this tutorial:

  • You have connected Serviceclarity to JIRA.
  • You have access to the Time Spent Metric.

Who is this useful for?

A technical project manager that wants to find out how much time each of their developers is spending on stories.

Steps:

Add a new Time Spent Metric

  1. Select the Connections Tab
  2. Select your JIRA Connection
  3. Select the Metrics Panel to display the list of available metrics being pulled in from the connector.
  4. If the “Complete Time Spent - Stories” metric is not there, you will need to add it. To add a new metric, select “Add +” on the “Metrics” panel.
  5. A new JIRA metric dialogue will open where you can configure the metric.

For the Completed Time Spent metric, you should configure it to this:

Click Save.

6. For the JIRA Query, we enter {base_jql} which selects the default project name which has been added to this collector. If you aren’t sure what this is, go back to your collector and select “Configuration Options” and you will be able to see your base JQL.

{base_jql} AND issueType = 'Story' AND status = 'Done' AND (resolutiondate >= '{START_OF_DAY}' AND resolutiondate <= '{END_OF_DAY}') AND timeestimate is not EMPTY and timespent is not EMPTY

What we are doing within this JQL query is selecting the types of issues we are trying to find, which is Stories, so issueType= ‘Story’.
Then we need to select the stories that have already been completed using “Status =Done” We then track the issues that have been resolved between the start and the end of the day using (resolutiondate >= '{START_OF_DAY}' AND resolutiondate <= '{END_OF_DAY}')

and add “timeestimate is not empty” and “timepent is not Empty” so that we tell JIRA to provide only data that has estimates and time recorded on them.

7. Now let’s add the breakdown so that we can filter the KPI to show the Priority, Assignee, Epic Link & Sprint. 

8. Select the “Convert to KPI” button, which will convert the metric into a KPI. It will now be available within the KPI library.

9. Next, we need to display it correctly within the trends and reports.

To do this, use the following KPI Calculation Definition:

var completed = metrics.getLatest();
var value = completed.value(0) / 3600;
var breakdown = completed.breakdown().scale(1 / 3600);
return {

    value : value,
 breakdown : breakdown
}

10. Finally, the last step is to test it, so if you select the “Recalculate” button ServiceClarity should now display data on the trend, showing a breakdown of assignee, priority, client, Epic, Sprint.


We hope this article has been helpful. If you have any other suggestions for How To Guides on creating particular KPIs, please send your request to our customer support team via intercom.  

Did this answer your question?