Zendesk: Query Builder

In this article, we will show you how to create a custom query using the Zendesk Query Builder. 

For this example, our goal is to create a new metric that will reflect the number of "old" tickets from email. Therefore, we're looking for a count of all tickets where priority is greater than "low", status is not equal to "new" and source is "email."

IN THIS ARTICLE

1. Basic Options

A
 Custom Query Name (required): Create a name for your custom query in this field. You will find this name/title as a metric option in the designer after saving the query.

We chose to name our sample query "Old Tickets from Email".

B
  Radio buttons (required): Change between "Search Builder" and "Search Query". Inside Search Builder you can find your result simply by choosing right options in requested elements. Inside Search Query you write search query like you do when you search data inside Zendesk.
C
  Type ( required ): Display your data according to selected type (  Ticket and  User). The query will only return results for the type you choose.
For this example, we chose Type: Tickets.
D
  Date range (required): To display your data the way you'd like, you will need to choose a date range. Click on the "Date range" field and select intervals that you want enabled for the new metric. These will be the only options available for this query in the designer. 
Read more about date ranges:  Adding and Modifying Additional Date Range.
E
  Interval Filter Field (required): In order to filter ticket by action dates, you will need to choose a Interval Filter Field. This options are CreatedUpdatedSolved and  Due Date.
In our example, we selected "Updated" so we can see when the last action was taken. 
F
  Compare With (optional): Select a date range to compare your previously selected interval to. This date range will be used for the "previous line" on line and bar charts, and for calculating change % in other visualization types.
Options are:  NonePrevious interval and  Same interval last year.
G
  Filter by (optional): You can choose to filter results by dimensions or by specific metrics. Filters can be combined using  AND boolean logic. Filtered queries restrict the rows that do (or do not) get included in the result. 

Metric Filters:

Each row in the result is tested against the filter. If the filter matches, the row is retained. If it doesn't match, the row is dropped.

For our example, here's how each metric filter row would be tested:
  • Equals: Return results for tickets where priority is exactly low
  • Does not equal: Return results for tickets where priority is not low
  • Greater than: Return results for tickets where priority is strictly greater than low
  • Less than: Return results for tickets where priority is strictly less than low
  • Greater than or equal to: Return results for tickets where priority is low or more
  • Less than or equal to: Return results for tickets where priority is low or less

2. Advanced Options

In the "Advanced Options" section you have the ability to specify an exact search phrase. Our case would return tickets with "Date issue" string inside their tag, name, description, etc.

3. Search Query

If you prefer to use Zendesk Search, you have the ability to pull data using a Search Query. This is selected in the radio buttons under your custom query name. Databox's Search Query follows the same rules as Zendesk Search. If you're interested in learning how to use Zendesk Search, here is a tutorial.

A
   Custom Query Name (required): Create a name for your custom query in this field. You will find this name/title as a metric option in the designer after saving the query.
B
   Search Query: In this text box write search terms to filter data. All available terms and how to use them is described in section 1 of this document.

When everything is set, click "Run query" to show your Data preview.

4. Data Preview

In Data Preview you will see total values for your new metric.

You can only get total values for today, yesterday, etc. If you want to see a change for your metric on a databoard (for example on line chart visualization) you have to collect data for several days/ weeks.

When your query is ready, click "Save query." This creates a metric in Databox, with the metric name the same as the custom query name you set.

In our example, this is number of "Old Tickets from Email".

Round values:

Click  "..." next to "Value" and select "Round values." Enter the number of decimal places to be rounded to in the corresponding textbox, and values will be rounded accordingly.

Still need help? Contact Us Contact Us