When the metrics and attributes included with Explore do not meet your needs, you can create your own custom metrics and attributes. In this article, you'll learn about standard calculate metrics and standard calculated attributes. These enable you to create new metrics and attributes using the metrics and attributes included with Explore along with a variety of formulas, mathematical functions, and more.
For a list of all available calculated metrics and attributes, see Calculation types reference. For an introduction to writing formulas, see Writing Explore formulas.
This article contains the following sections:
Creating standard calculated metrics
Standard calculated metrics enable you to create completely new metrics to add to your dataset. You can use pre-existing metrics and attributes from your dataset, and functions included with Explore's formula writing language.
IF ([Ticket channel]="Email") THEN [Ticket ID] ENDIF
To create a standard calculated metric
- In query builder, click the calculations icon (
) on the right sidebar.
- Click Standard calculated metric. The Standard calculated metric page opens.
- In the Name field, type a name for your new metric.
- In the Formula field, use the Fields drop-down list to add existing metrics to your formula, or click Explore's auto-complete suggestion as you type the formula.
- If you want to add functions to your formula, click Add under Functions or click Explore's auto-complete suggestion as you type the formula. For a full list of all available functions, see Explore functions reference.
- Check Compute separately if your formula is using existing calculated metrics and attributes, and you do not want to affect their calculations.
- Click Save. The metric is saved to the dataset you currently have loaded.
You can now add this calculated metric to your query. When you click Add in the Metrics panel, you'll find you metric in the Calculated metrics folder.
Creating standard calculated attributes
Use standard calculated attributes to create new, custom attributes to add to your dataset. Standard calculated attributes can use existing attributes and metrics as well as functions from Explore's formula writing language.
-
Computed from: The drop-down list displays metrics and attributes you can use in your standard calculated attribute.
Important: Although you can choose standard calculated metrics from the list, this can lead to inaccurate results and is not supported. Use only the metrics supplied with Explore in your standard calculated attributes.
- Sort like time attribute: If your calculated attribute represents dates, this option places your date values in the correct order.
When you click Add in the Columns, Rows, Explosions, or Filters panels, you'll find your attribute in the Calculated attributes folder.
32 Comments
I'd like to have my ticket ID's in a table view hyperlink to the ticket url (like it does out of the box in GoodData), but I can't figure out the syntax for achieving that with a Standard calculated attribute. Can you help me out? Thanks.
Hi Jacob, I'm working on a recipe for doing exactly this, and it should be released sometime next week.
However, as a teaser, try this formula:
Replace 'support.zendesk.com' with your own subdomain.
Also, in the chart configuration menu, choose Chart > Text Interpretation, and choose HTML.
Finally, on the same page make sure that Clickable URL is checked.
This is still in draft, so is unsupported, but hopefully gives you a starting point.
Awesome! That works from the web UI, will it be possible - at some point to also have it available in exported reports? PDF's and Excel is what I'm thinking.
Thanks Rob!
Hi Jacob, I'll make sure to forward that request onto the correct folk. Rob
Finally, here's the link to the new recipe for clickable links - https://explore.zendesk.com/hc/en-us/articles/360002084927-Explore-recipe-Configuring-clickable-links-to-tickets
Thanks a lot Rob!
I'm about ready to give up, so maybe someone has had a similar idea. I'm looking to generate a time series of how many agents took chats per each hour of the day, this would give me my actual staffing that day.
Has anyone tried to do that? I've tried creating a Calculated metric with DCOUNT_VALUES[Agent Name] but it acts funny, like I can't graph it by adding the hour started column, it just gives me the same number for each hour. I feel like I'm close, but I'm just missing something. I'm sure I could wrangle the SQL, but I can't get this.
Don't have any help for Scotty but I've been having a very similar issue and I'm sick of bashing my head against the wall. I'm simply looking to calculate a daily average, year to date, of how many public replies agents post in tickets.
The problem is that I can't calculate against or pull a D_COUNT of Updates - Date because it's a filter, not a metric, and I can't figure out how else to tally how many days a given agent actually replied to a ticket to exclude days they weren't working, etc.
Hello Saxon Clay,
I would recommend looking into this article that should help you with setting this up in your explore instance.
Best regards.
Hello,
Team is working on migrating our existing reports from Insights to Explore. We have a large number of custom metrics created, which are sorted in insights with a folder structure. It appears that Explore doesn't have a folder structure for saving metrics, but you can silo them in data sets.
Are there plans to allow the creation of metrics outside of queries, and allow them to be managed outside of queries as well?
Is there any way to sort custom metrics by name?
Currently the list shows them in the order they have been created. Due to the differences in the custom metric language. We often find that to recreate metrics that we use in insights, we have to create sub-metric to then be used. (For example, you can't SUM an IF/THEN statement in a custom metric formula. I need to make a separate IF/THEN Metric that sums the data I need, and then use that custom metric in another Custom Metric data formula)
This often makes it hard to find metrics due the additional metrics created as well as not being sorted by name.
Thanks,
Jason
Hi Jason, there's isn't a way to do the things you are asking for at the moment. However, I do know that the product team are doing a lot of work currently to improve management of queries so this is great feedback. Would you consider posting this in our Explore feedback form at https://support.zendesk.com/hc/en-us/community/topics/360001200913 where other customers can vote on your suggestion? It really helps the team to prioritize what work to do next. Thanks!
Want to graph a calculation but I can't get it to report correctly.
Want to sum the tickets created this week plus the previous 12 weeks and then divide them by 13.
This to be graphed on a trend.
Anyone knows how to do this?
Hello Joel,
So if I am understanding this question correctly I would recommend following the instructions on these two articles. They will breakdown how to set up a calculated metrics and then display it as desired.
Adding time and date calculated metrics
Chart types for comparing trends over time
Visualization types reference
Best regards.
Hi,
I'm trying to create a "target" metric in Explore for my dashboard.
For example - if I have 200 tickets created yesterday, I want to be able to show the target number of tickets to be completed for 2 agents, as an anchor point. So this imaginary metric would show up as "100". This should change as the day changes.
However, I am struggling a little bit in making this.
I already have a date range calculated metric for # of tickets created yesterday ("Tickets created yesterday"). Easy.
I am now trying to build a standard calculated metric off this date range calculated metric by writing this formula: =count(Tickets created yesterday)/2. Should be pretty simple, but nothing is being returned in the query. I feel like I am missing something obvious... can someone help?
Hey Tim,
I reached out to one of our Explore experts and they confirmed that the formula you're using should work. They were able to get the following to work:
If the above doesn't work, can you provide a screenshot of the formula you're using?
Hi! We're trying to perform a percentile-type calculation like the following: "80% of tickets were first-replied before X minutes". So we came up with this formula:
So, to the average reply time, add almost one standard deviation. But... the results we're getting are not correct. For instance:
So for January 2020 I'd expect the "80%" column to be equals to 30 + 8 / 0.86 -> 36.88, but the calculated metric returns 102 instead. I tried changing the aggregator function to other functions, but the result is always the same, except if I pick std_dev, which brings another - incorrect - value.
What am I missing?
Just an update on my last post. I was able to solve it. The calculation was right, it was just at the wrong place.
So, what I had to do is to add the metrics:
Then, in Result Manipulation, I created a Result metric calculation:
and checked the "Clear used metrics" checkbox, because I have no interest in showing the average time or stdev in this graph. And that did the trick for me!
Thanks so much for coming back and sharing your answer, Fernando! Glad to hear you got things working. :)
Hi there,
I'm trying to make a custom attribute. In my query AVG First reply time I want to exclude tickets with certain tags.
In Standard calculated attribute i'm trying to list all the tags in the formula, but I'm getting an error. I've tried listing them with/without comma, space etc, but can't get it working. If anyone could advise we would be grateful.
It does work when I have only one tag, but not for multiple.
Thanks

Hi Vladimir Petrushenka thanks for the question.
We made some changes to how tags work recently. Take a look at https://support.zendesk.com/hc/en-us/articles/360022183574 for help.
In particular, the section on filtering at https://support.zendesk.com/hc/en-us/articles/360022183574-Reporting-with-tags#topic_z5w_mhz_2mb looks like exactly what you need to do.
I hope this helps!
Thanks Rob Stack, looks like I've manage to get this working. Much appreciated!
Hi Support,
I am trying to build a query which calculate the percentage of ticket first reply <=15mins.
First I build two new attributes. One is Ticket reply <=15 mins and one is Ticket reply >15 mins
And then I set up a new metrics which is the percentage of ticket reply <=15mins.
The formula is COUNT_VALUES([Ticket reply <=15 mins])/(COUNT_VALUES([Ticket reply <=15 mins])+COUNT_VALUES([Ticket reply >15 mins]))
Unfortunately, the result is not correct. May I know if there is any wrong in my formula?
Hello Jamal Tse,
Can you try to change the formula like this?
Let me know if it works for you.
Thanks,
Violeta
I think the formula works, but the figure shown in this query is still different from the report in insight. I wonder if this is because of the filters.
May I know how to set this filter in explore? I could not reach for this one.
Many thanks
Hello Jamal,
1. If you set the ticket status isn't Deleted then you have it the same as Explore because Explore doesn't count deleted tickets. You cannot include or exclude Deleted tickets from Explore.
2. There are differences between Insights and Explore. As you can see Explore offers the possibility to use different datasets like Tickets, Ticket Updates, Backlog and Insights uses event timestamp. So sometimes there can be some differences. For a detailed check of the differences in numbers i encourage you to:
- first export the data at the ticket id level from both Insights and Explore, then compare it to see how many differences you have and try to identify a pattern by taking random tickets and checking them in Support. Maybe this will give you an idea of using another filter or attribute. It will give you the clarity to understand why there are differences.
- after you do that if there are still questions you should open a ticket to Zendesk Support so they can check your instance/queries and clarify the situation.
Hope i could help you Jamal.
Wish you a great day!
Hi,
I would like to create an attribute custom metric of which will state "Contains" and unsure how to write the formula. The goal would be to pull a set of ticket tags that "contains" the term "macro_" as the set of ticket tags vary. For example, macro_1, macro_2, etc.
Any suggestions?
Taline
Hi Taline,
Here is an example:
"IF (
([Ticket status - Unsorted] = "Solved"
OR [Ticket status - Unsorted] = "Closed")
AND INCLUDES_ANY ([Ticket tags], "%macro_%")
)
THEN
[Ticket ID]
ENDIF
The first condition I used because I wanted only the Solved tickets but you can change it.
Hope that it helps.
Happy reporting!! :)
Hi Violeta,
Thank you for getting back to me so quickly. I tried the formula and it provided me tickets that didn't have the tag that I mentioned. I had created it as an attribute metric. Should I have made this as a metric?
Taline
Hi Taline,
I am using it as a metric.
Can you try to built the metric the to show me the formula to see how it looks?
Thank you!
Hi Taline Moroyan, you'll find other examples in addition to Violeta's in this article: https://support.zendesk.com/hc/en-us/articles/360022183574
Please sign in to leave a comment.