Time Tracking recipe: The metrics you need to be measuring Follow

Comments

37 comments

  • Avatar
    Sam Russell (Concero)

    Is there a way that the total time spent could be in hours as minutes is useful but when running a report i don't want to have to transfer everything from minutes to hours.

  • Avatar
    Brent

    @Sam - yes! All you need to do is divide your metric by 60 another time to go from minutes to hours. For example, the MAQL will look like this:

    SELECT SUM(IFNULL([Numeric Field] New value,0) - IFNULL([Numeric Field] Old value,0)) / 3600 WHERE Numeric Field = Total time spent (sec)

  • Avatar
    Sam Russell (Concero)

    @brent Thank you! Legend!

  • Avatar
    Arthur Goerlitz

    This was a very helpful article. I used all 3 reports. Thanks!!

  • Avatar
    Zach

    I keep getting this error with the 2nd metric: Unexpected 'BY'. Expecting: )

     

    I have tried it with 1-4 ) brackets with no luck. Please let me know what I am doing wrong.

     

  • Avatar
    Brent

    @Zachary it looks like you're using the "Total time spent (sec)" attribute value instead of the "Total time spent" metric in step one. Attribute values appear in orange text, and metrics appear in green text.

    In the end, it should look like this:

  • Avatar
    Zach

    I must be missing something as I do not have that metric in my list. Hmm

  • Avatar
    Brent

    @Zachary that metric is not included in Insights by default because it uses fields that only exist once the time tracking app is installed. You'll have to build it by following the steps in the "Metric 1: Total time spent" section of this article.

  • Avatar
    Chad Dunbar (Edited )

    When using these metrics and app, we found two issues:

    1. When slicing data by Updater, negative values were possible for any agent after the first, if they spent less time than the previous agents combined (Total time by Updater < Total Time).
    2. Some field values contained impossible values (eg. 50 days in a 2 day old ticket)

    We created a metric to handle values that are out of range and resolve negative updater values.

    This replaces values greater than 8 hours with 5 minutes (simpler than try to test for ticket age at the time of update) and works at the update level to remove the influence of the previous time spent by other agents. Then we just need to pull the average.

  • Avatar
    Chris Pettigrew

    Hi There:

    We have just recently started using Time Tracker and as such, there are many 'solved' tickets that simply don't have times associated with them. 

    I believe this is skewing our ticket times. I am only speculating, but would it average 'zero values' with other tickets that actually do have times? I tried to create a filter that only pulls from tickets that actually have times associated with them, however, the 'Total Time Spent' metrics don't seem to be available for use in Filters. 

    Any advice?

    Thanks. 

  • Avatar
    Amy Dee

    Hi Chris!

    These recipes should keep that from happening. If a ticket has no time tracking data, it should return a null value, not a 0. That means those ticket should be excluded automatically.

    If you're seeing something else, double check your metrics and make sure they match the recipes above. The most likely issue would be using IFNULL in the wrong place.

    As for your second question, you can't use metrics in a "List of Values" filter. That only works for Attributes. Instead, add a Numeric Range Filter:

    • For the Attribute, choose Ticket Id
    • For the Metric, choose Total Time Spent (min)
    • For the Range, choose "greater than or equal to" and enter 0

    This should limit your report to tickets that have a value in the Total Time Spent (min) metric.

    Happy reporting!

  • Avatar
    Hannah Morris (Edited )

    Here is what I have entered into the editor:

    [Numeric Field]SELECT SUM(IFNULL(*[Numeric Field] New Value*,0) - IFNULL(*[Numeric Field] Old Value*,0)) / 60 WHERE *Numeric Field* = *Total time spent (sec)*

    I get this error when trying to 'Add' it:

    Unexpected '[Numeric Field]'. Expecting: SELECT

     

    **EDIT**: Nevermind, solved it! Had that random [Numeric Field] in the beginning. Sorry-- thanks!

  • Avatar
    Jessie Schutz

    Hey Hannah! Glad you got it working. :)

  • Avatar
    Rosalie Chen

    Hello,

    I am having trouble finding the Attribute Value "Total time spent (sec)" for the first metric. When I click Attribute Value on the Elements menu, it just opens up Attributes, instead of Attribute Values. And I am not able to find the "Total time spent (sec)" under Attributes. 

    Thanks!

  • Avatar
    Amy Dee

    Hi Rosalie! Attribute values are listed under their attributes. That keeps the list organized.

    To find Total time spent (sec), go to Attribute Values, then select Numeric Field. This should open a new list with all the available values for that attribute, including Total time spent (sec).

    I hope this helps! Happy reporting!

  • Avatar
    Kristina Drosos

    I'm not seeing Total time spent (sec) under Attribute Values. Do I need to add the app first?

  • Avatar
    Andrew J

    @ Amy_Dee @Kristina - I'm missing Total time spent (sec) under Attribute Values 
     too - and we've had it installed for a year or more.

    Any ideas?

  • Avatar
    Andrew J

    I found a total time spent (sec) under metrics... are the instructions wrong?  

  • Avatar
    Amy Dee

    Hi Andrew! For the recipes in this article, you need to use the Total time spent (sec) under Attribute Values. The recipes are correct. In your case, you may have created a metric with the same name at some point. 

    I recorded a short, animated GIF showing where to find Total time spent (sec) in the Metric Editor. (You must install and use the Time Tracking app before it populates in Insights.)

    You can see that the "Attribute Values" option takes me to the "Attributes" list. I select Numeric Field first, since that is what I'm using in my metric. Then I can choose a value under Numeric Field. When it is selected from the right place, Total time spent (sec) will appear orange.

    I hope this helps! Happy reporting!

  • Avatar
    Andrew J

    I went through and deleted the last attempt I had made, then it worked.

  • Avatar
    Joshua Willcox

    I'm curious about the logic behind the formula for Metric 1: Total time spent.

    Is there a specific reason you recommend doing a sum of "new value - old value" in that manner? Unless I'm missing something it seems like a sum of "Time Spent Since Last Update" or even just grabbing the max/final amount for "Total time spent (sec)" would both give you the same value, and would be much simpler.

  • Avatar
    Amy Dee

    Hi Joshua! I know it looks complicated, but this version of the recipe is a bit more reliable than simpler options.

    The final value of the Total time spent (sec) field would give you the total time for the ticket as a whole, but it wouldn't allow you to see the handle time for individual updates.

    The Time spent last update (sec) field has an edge case exception that we want to avoid. These metrics are based on numeric field changes. If you post two updates in a row with the exact same handle time, then there isn't technically a change to that field. The second update won't have a value for Time spent last update (sec) that can be captured in a metric. However, the Total time spent (sec) value will still increase.

    When the Time Tracking app is on its default settings, these duplicate updates are rare. There's a simplified mode, though, which is far more likely to repeat values.

    I hope this helps. Happy reporting!

  • Avatar
    Joshua Willcox

    Hey Amy,

    Ahhh, I didn't consider that edge case for Time spent last update - that makes perfect sense. Thanks for the quick response!

  • Avatar
    Andreas

    Heya,

    I am trying to build a metric similar to the Average time spent per update (min). Similar as in I am trying to break it down even more (into Avg time per public comment and Avg time per private comment) and I am running into some issues.

    When trying to replace SELECT AVG(SELECT Total time spent (min) BY Ticket Updates) with SELECT AVG(SELECT Total time spent (min) BY Public Comments) it sort of works, except the resulting numbers are really far off.

    And I can't seem to find a way to utilize Private Comments either.

    Any ideas?

  • Avatar
    Amy Dee

    Hi Andreas! This sort of report should be possible. It's a bit different from your approach, though, due to how comments are recorded in the data model.

    There are three relevant attributes here: 

    • Ticket Updates identifies each update on a ticket, regardless of where it came from or what changed in the update
    • Comment Present identifies whether any given update included a comment
    • Public Comment identifies whether any given comment was public or not

    The Ticket Updates attribute is the base for the dataset, so it can anchor a metric. The other two can be used to filter your results.

    In your case, I recommend creating the Avg time spent per update (min) metric described in the article above, where you use BY Ticket Updates. Then you can make two customized versions for comments:

    Avg time spent on public comments
    SELECT Avg time spent per update (min) WHERE Comment Presenttrue AND Public Commenttrue

    Avg time spent on private comments 
    SELECT Avg time spent per update (min) WHERE Comment Presenttrue AND Public Commentfalse

    These metrics should find the average handle time in minutes, but only for updates which include a public or private comment, respectively.

    I hope this helps! Happy reporting!

     

  • Avatar
    Andreas

    Thanks! That seems to do the trick. I appreciate the help.

  • Avatar
    Martin Kølbæk

    When trying to follow the first step, I get the following error:

    What am I doing wrong?

  • Avatar
    Chad Dunbar

    Hi Martin,

     

    It look like you're hitting Add. In this case, use +Add Selected in the top right.

  • Avatar
    Martin Kølbæk

    Yikes, don't know how I missed that. Thanks Chad!

  • Avatar
    Martin Kølbæk

    I'm experiencing the same issue as Kristina and Andrew. I've ensured that the app is installed andI can see that the Ticket Fields are added in Zendesk, but I still don't see the Total time spent (sec) in Attribute Values or anywhere else.

Please sign in to leave a comment.

Powered by Zendesk