Query¶
From the Query pill, you can build a query on the metric view to retrieve and analyze aggregated data. With the help of a wizard, you can customize several aspects of the query: select the specific dimensions and metrics to retrieve, filter the data using conditions, sort the results, and more.
Wizard to define a query on a metric view graphically¶
The metric view fields are organized into two sections: Dimensions and Metrics. You can add fields to your query by selecting and adding them, or by dragging them into place. If you drag a dimension, all of its attributes will be added to your query.
You can apply derived functions or conditional logic to dimension attributes to create more advanced groupings.
For example, you can use string manipulations, mathematical functions, or conditional statements (such as CASE WHEN)
to customize how your data is categorized.
Conditional logic applied to a dimension attribute¶
Because metric views are specifically designed to aggregate data, querying them introduces certain unique behaviors and limitations:
A query must always include at least one dimension in the output columns. It is valid to execute a query using only dimension fields but it is not allowed to execute a query with only metric fields.
Executing a query on a metric view requires grouping by the projected dimensions. Whenever you add a dimension column to the output, it is automatically included to the
GROUP BYclause.You cannot apply aggregation expressions to dimension fields.
Metric fields cannot be used as output fields with custom expressions.
Metric fields must be used with the
EVALUATE_METRICfunction. This is added for you behind the scenes unless you are creating an expression filter.You can apply conditions to both dimensions and metrics. If a condition is created on a dimension, it is added to the query’s
WHEREclause. If a condition is created on a metric, it is added to theHAVINGclause.Any field that you want to use to sort your results must also be included in your output columns.
If you are building an invalid query for a metric view, a icon will appear. Hovering over this icon
displays a list of issues that need to be fixed.
Warning tooltip with a list of issues that have to be fixed¶
If you are in a wizard building an expression that is not valid, a icon will appear. Hovering
over this icon displays the issue that has to be fixed.
Warning tooltip with an error message due to an invalid expression¶
If you want a deeper understanding of metric views and how to query them using VQL, go to Querying and Consuming Metric Views.
For more detailed information on how to use the wizard and build queries in the Data Marketplace, please check the Query of Views documentation page.
Visualizing the Result¶
Once the query is executed and you are in the Results tab, you can easily explore your data visually. A Visualize button is available in the top-right toolbar of the results area.
Clicking this button automatically triggers the Denodo Chatbot Assistant. The assistant analyzes the structure of the query and dynamically generates an appropriate chart that best represents the dataset.
Visualize button in the query results toolbar¶
Denodo Chatbot Assistant displaying the generated chart¶
Note
The Visualize button is only available if the Chatbot has been enabled. To learn how to activate and configure this feature, please refer to the Denodo Assistant Chatbot Configuration documentation page.