Reporting on ticket tags in Insights when taking one of the following actions:
- Excluding one or more tag(s) from a report
- Filtering reports by tags
Zendesk Professional or Enterprise account with access to Insights
Reporting on tags is tricky in Insights. There can be any number of tags on a ticket at the same time, and you may need to report on any one of them.
To make this possible, tag data is stored in its own dataset. While this gives you the ability to report on individual tags, regardless of how many tags are on each ticket, it does mean you need to take some extra steps.
This article just covers the basic recipe. For more information about how tag reporting works, including the logic behind this recipe and some specific examples, check out this article: Reporting on tickets with one or more tags.
Create a custom metric for each tag
Since tickets can have multiple tags at the same time, almost every ticket will have at least one tag record that is not the one you're filtering for. This means any filter using Ticket Tag ISN'T, Ticket Tag <>, or Ticket Tag NOT IN will just return all tickets. You must create the metric described below and use a numeric range filter to include (=1) or exclude (=0) tickets with certain tags.
You need to create separate metrics for each tag you want to include in reports. The metrics should all follow this template:
- SELECT IFNULL((SELECT # Tickets WHERE Ticket Tag = your_tag),0)
- Replace your_tag with the tag you want to use in the report.
This metric will return a 1 for tickets that do have the tag and a 0 for tickets that don't have the tag. That means you can use it to include or exclude tickets based on their tags.
There are two main ways to do this:
1. Add a numeric range filter to the report
- For the attribute, select Ticket Id.
- For the metric, select your custom tag filtering metric.
- For the range, there are two options:
- Select "is equal to 1" for tickets that do have the tag.
- Select "is equal to 0" for tickets that do not have the tag
This will filter the whole report based on the tag in your metric. This is useful if you want to compare several different metrics with the same tag restrictions.
2. Nest the tag filter in a custom metric
This will vary a bit, based on the metric. However, the tag filtering portion should follow this template:
- Tag is present: SELECT metric WHERE (SELECT # Tickets with your_tag BY Ticket Id)=1
- Tag is not present: SELECT metric WHERE (SELECT # Tickets with your_tag BY Ticket Id)=0
This allows you to compare different tag filters within the same report.