Overview
Use the Semantic Metric Query API to send metric-based queries against your Semantic Model. The Semantic Metric Query API allows you to leverage your data in Data 360 through Tableau Semantics to answer business questions using predefined metrics.
First, start with an existing Semantic Model that contains semantic metrics, or build a new Semantic Model through the Tableau Semantics Authoring Experience or Authoring Connect API. Then, you can use the Semantic Metric Query API to send metric queries that leverage your Tableau Semantics data (including any Semantic Definitions, and Metrics) to obtain exact results for each business case by selecting the measure, time dimension and using various metric parameters, such as additional dimensions, time range and sorting.
A semantic metric query is a logical request that defines what metric data to retrieve from the Semantic Model. It's processed by the Semantic Metric Query Generator, which translates the request into optimized SQL over Data 360 objects, runs it in the context of your tenant, and returns the results.
The Semantic Metric Query is composed of the following properties:
- A metric definition that specifies the metric measure and time dimension.
- Additional dimensions to group the metric results by
- Sorting and filtering options for the results
- Semantic context including timezone and locale settings
A Semantic Metric Query is first sent to a gateway service and then the metadata associated with the objects being queried (Semantic Model Objects, Semantic Definitions, and Metrics) is fetched from Salesforce Core and Data 360. The SQL query is then generated and executed.
The following is an example of a Semantic Metric Query with a Model ID:
The following example shows a complete Semantic Metric Query with a Semantic Model: