There are two different ways you can add new queries to Explore. This section will discuss both methods for creating new queries. Once you add a new query, you will be redirected to the Query Builder. You can then build and customize your query, as described in later sections of this article.
For more detailed information see, Creating a new query.
You can create queries from either the Queries library or directly from a dataset. No matter which option you choose, you will need to have a dataset added to your Zendesk Explore account.
If you want to create a query from the Queries library, you can click the New query button on the upper right of the Queries library. After you click the New query button, you will be prompted to select a dataset to create the query from. See Creating queries for more information.
Alternatively, you can create a query directly from a dataset in the Datasets library. You can easily do this by selecting New query from this... from the Settings() drop-down list to the right of the dataset name. See Creating queries from datasets for more information.
Try it yourself: Add a new query
This try it yourself will discuss how to create a new query from the Queries library. To follow these steps, you must have already editable data to your Zendesk Explore account (see Importing your Zendesk data). This example uses the Zendesk Support Tickets dataset.
- Click the Queries library icon ().
- Click the New query button.
- Hover over the dataset containing the information you want to use in your report.
- Click Select.
You will automatically be redirected to the Query Builder.
Building queries basics
This section will discuss the very basics of building queries and important information you should know before starting. After reading this section, you should be able to create a simple query in Explore. The later sections in this article will discuss how to customize the query.
Adding metrics and attributes
The first step to creating a query is to identify and add the information you want to analyze. Your Zendesk data is divided into metrics and attributes. Metrics are quantifiable data, such as # Tickets, Replies, First Reply Time, etc. Attributes are qualitative data, such as Date, Group, or Tag. Attributes slice your metrics' results by the different values included in the attribute. For example the attribute Assignee Name would list your different Zendesk Support assignee names as the values. If your query included the # Tickets metric and the Assignee Name attribute, you would see the number of tickets for each assignee.
In the Query Builder, you can add your metrics and attributes to five different locations (see Introduction to the Query Builder interface). Metrics can only be added on the Metrics box at the upper left of the Query Builder (see Adding metrics). Attributes can be added to Columns, Rows, Explosions, and Filters, located around the rest of the Query Builder frame.
Metrics can be added to the Metrics box in the upper-left corner. Every report must contain at least one metric. You can add metrics in different sizes, colors, on a dual axis, to a trend line, or include them in datatips (see Adding metrics). You can calculate your metrics' results in different ways, such as summation (SUM) or count (COUNT). You can see what calculation is currently applied by looking at the aggregator in front of the metric name. Explore will automatically apply a default aggregator, but you can select a new one. See Changing metric aggregators.
Attributes can be added to Columns, Rows, Explosions, and Filters. Your results will render differently depending on where you place the attribute. See Adding attributes.
- Columns renders your results in one chart. The Columns box is located above your visualization. See Adding attributes to Columns.
- Rows renders your results into individual charts for each of your attribute values. You can navigate through the individual charts. The Rows box is located underneath Metrics. See Adding attributes to Rows.
- Explosions renders your results into multiple charts, each representing a different value for the added attributes. Charts are shown side-by-side in one query. The Explosions box is located underneath Rows. See Adding attributes to Explosions.
- Filters restricts which results are shown without the attribute appearing on your query. The Filters box is located at the bottom of the Query Builder. SeeAdding attributes to Filters.
For more information on adding metrics and attributes, see Adding metrics and attributes.
Selecting a visualization
In Explore, you can select from over 20 different chart types or visualizations to display your data in the most efficient format for your team. Once you add your metrics and attributes to your query, Explore will automatically render your query in the visualization that best suits your added data. You can change the chart type in the Visualization type menu on the right sidebar. If you have not select a different visualization, the Visualization type menu icon will show Explore's auto-chart icon (). If you have selected a different visualization, the Visualization type menu icon will reflect the visualization you selected.
The image below shows the visualizations available in the Visualization type menu. For a list of all the visualizations available and their unique customization options, see Visualization types reference.
Saving your query
When you finish building your query, you will need to save it. You can click the Save button () in the upper of the Query Builder to save your query. For more information on saving, see Saving your query.
There are four different saving options you can select from:
- Save as new to dashboard: Adds your query to a new or existing dashboard (see Adding a new dashboard). Your query will also be saved to the Queries library.
- Save as new in the Library: Saves your query to the Queries library.
- Explore: Provides a CSV, image, PDF, or Excel file of your query. Exporting your query will not save it to the Queries library.
- Update query: Appears if you are editing a pre-existing query. You can use Update query to save your changes in all locations.
See Saving your query for more information.
Try it yourself: Build a new query
This try it yourself will practice creating a simple query measuring the number of open tickets by assignee, but you can replicate these steps for other data. You must add editable data to your Zendesk account before creating a query (see Importing your Zendesk data). For more resources on creating queries, see Building queries.
- In the Query Builder, click the + next to Metrics.
- Select a metric. This query uses # Open Tickets.
- Click Apply.
- Next to an attribute location, click the + button. This query uses Columns.
- Select an attribute to add. This example uses Assignee Name.
- If you would like, select a different visualization from the Visualization type menu. This query selects a bar chart.
- Click Save and select your save option.
You have now successfully created your first query. You can read the section below to learn how you can customize this query.
After you add your data, you can begin to customize your query, so it is most impactful for your team. In the Query Builder, you can find the available customization options on the right sidebar (see Introduction to the Query Builder interface). There are three menus containing customization options. For more information on customizing queries, see Customizing queries.
- Visualization type menu: The Visualization type menu is the first icon on the right sidebar and will reflect either your currently selected visualization or the auto-chart icon (). You can use the Visualization type menu to select a new chart type (see Changing your chart type). For a list of all the visualizations available and their unique customization options, see Visualization types reference.
- Data structure menu: The Data structure menu () is the second icon on the right sidebar. The Data structure menu enables you to make changes to data after you import. You can rename elements, organize and create folders, and set attribute permissions. See Editing your metrics and attributes for information on each option available in the Data structure menu.
- Chart configuration menu: The Chart configuration menu () is the third icon on the right sidebar. It contains all your primary customization options, such as chart color, text formatting, and additional options unique to each type of visualization. For information on each option available in the Chart configuration menu, see Customizing your query.
Try it yourself: Customize your query
If you've already added metrics and attributes, you can begin to customize your query. There are several ways you can customize each chart type. The try it yourself below will change the color of the bar chart created in the selection above. These options might vary for different chart types.
- Click the Chart configuration menu icon () on the right sidebar.
- Select the Colors option.
- Underneath Automatic color, click the color swatch in front of the metric name or click Apply predefined palette. The predefined palettes contains Explore's suggested color groups.
- Select a color, then click Select.
- Click the Chart configuration menu icon again to close the menu.
Your query will be updated with the new color. Make sure to save your query before navigating away from the Query Builder (see Saving your query).
Performing calculations and creating custom metrics and attributes
In Explore, you can perform calculations on your data to analyze results such as the total, percentage, or future values. Explore makes calculations easy for you through result manipulations. Result manipulations provide you with a simple template for applying calculations. In addition to result manipulations, you can also create completely new metrics and attributes using functions and pre-existing formulas with Explore's Calculation engine.
For more information on calculations and custom elements in Explore, see Calculation types reference.
About result manipulations
Result manipulations are an easy way to apply calculations like totals, the percentage difference, and more. You can also use result manipulations to hide, sort, restrict, and predict future results. Unlike Explore's calculated metrics and attributes, you do not need to write any formula.
Result manipulations are located in the Result manipulation menu (). The result manipulation menu is the third menu on the right sidebar (see Result manipulations reference). When you click the Result manipulation menu icon (), you will see several calculation options you can apply to your report.
Result manipulations are applied after your metrics and attributes are processed in the query, so they will appear on the Filters bar above Filters. If you add several result manipulations, the order you apply the result manipulations might affect the outcome of your result. See Setting the order for your result manipulations for more information.
For information on the different types of result manipulations and how to add them, see Result manipulation reference.
About custom metrics and attributes
In Explore, you can create custom metrics and attributes or calculated metrics and calculated attributes to apply more detailed and advanced calculations to your results. Using calculated metrics and attributes, you can create new, custom metrics and attributes to add to your dataset. You can use calculated metrics and attributes to create unchanging metric results, rename attribute values, create completely custom new metrics and attributes, and more.
Calculated metrics and attributes are located in the Calculation engine menu (). The calculation engine menu is the last icon on the right sidebar in the Query Builder. When you click the Calculation engine menu icon (), you will see several calculation options you can apply to your report.
For a list of all of the different calculated metrics and attributes and how to add them, see Calculated metric and attribute reference.
Like your normal metrics and attributes, you will need to add calculated metrics and attributes to your query by selecting them from the one of the metric or attribute locations (see Adding metrics and attributes). When you add a calculated metric or attribute to your query first, it will filter your results before they are processed. Calculated metrics and attributes can help speed up loading time for large datasets by filtering results before they are processed.
Most calculated metrics and attributes provide you with pre-built templates for creating calculated metrics and attributes, but if you would like to create completely custom metrics or attributes based on your own entered functions, you will need to use Explore's formula writing language. The next topic in this section will discuss writing formulas, or you can see Formula writing resources.
Writing formulas in Explore
Some custom metrics and attributes give you the freedom to create completely custom elements using any formula. This can be as simple as adding two metrics together or more complicated calculations such as finding the absolute difference between two dates. When you select to create a calculated metric or attribute that requires you to enter formula, you will automatically be redirected to the Formula window. The Formula window contains all the different resources you need to create dynamic formulas (see Navigating the Formula window).
There are two primary locations you will need to use to create dynamic formulas in Explore. The first is Fields on the bottom left corner of the window. When you click Select a field, you can choose a metric or attribute to add to your formula (see Adding attributes and metrics).
If you want to calculate your data in advanced, custom ways you will need to add functions to your Explore formula. Functions will perform different calculations to your Explore formula. These functions can perform five different types of calculations:
- Simple numeric
- Advanced numeric
For more information on the different types of functions, see Formula writing resources.
Try it yourself: Apply calculations to your query
This try it yourself will instruct you on how to use result manipulations to find the total of the results from the query created above. If you would like instructions on performing a different type of calculation, see Calculation types reference. For more information on the total result manipulation, see Adding totals.
- In the Query Builder, click the Result manipulation menu icon ().
- Select Totals to add totals.
- Select the location of the attribute to calculate your totals on. Since there is an attribute on columns in this query, grand totals are calculated on Columns.
- Check any of the three Advanced options available:
- Visual totals calculate results from metrics using non-additive aggregators, such as AVG, MAX, etc.
- Calculate all subtotals view a full breakdown of your subtotals.
- Inverse totals position position your totals as the first result on your chart. Totals are normally shown as the last column or row.
- Click Apply.
Totals will be added to your results. Because Totals is a result manipulation it will be added to the Filters bar above Filters. You can edit your totals any time by clicking the Totals filter.
The next article in this getting started tutorial will instruct you on how to build your own dashboards in Explore. See Getting started with dashboards to proceed onto the next section. If you are interested in modifying pre-built queries from a pre-built dashboard, see Getting started modifying queries. To view another article in the getting started guide, see the Getting started guide index.
See Getting started with dashboards to proceed onto the next section.