Semantic Metric Query Entities

The following are the top-level entities that compose the Semantic Metric Query API:

Field LabelTypeDescription
StructuredMetricQueryStructuredMetricQueryRequired. Representation of a semantic metric query.
dataspaceStringID of the data space in which the query is executed. The default data space is used if no data space is selected.
groupIdStringID of a group of queries. The query is sent as a part of this group if this field is defined.
sourceStringID of the source of the query used for usage lake reporting.
queryParameterStringQuery parameter name and value for parameterized queries.
semanticModelIdStringThe unique identifier of an existing semantic model to use for this query. When provided, the system will retrieve the model from the authoring service. Cannot be used together with semanticModel field.
semanticModelSemanticModelThe complete semantic model definition to use for this query. This allows you to provide the model inline without requiring it to be pre-saved. Cannot be used together with semanticModelId field.

The following are the fields within the StructuredMetricQuery object:

Field LabelTypeDescription
model_api_nameStringRequired. The API name of the semantic model to use for this query.
submetric_definitionSubmetricDefinitionThe metric definition that specifies which metric to query.
time_grainSemanticMetricTimeGrainTypeEnumThe time grain for the metric query (Day, Week, Month, Quarter, Year).
additional_dimensionsrepeated SemanticFieldReferenceArray of additional dimensions to add to the metric results.
time_rangeSemanticFilterTime range filter for the metric query.
sort_ordersrepeated SortOrderArray of sort orders that define how query results are sorted.
limit_optionsLimitOptionsLimits the number of results returned.
semantic_contextSemanticContextCentral class configuration that manages a variety of settings that determine how the query is executed and how results are shown. Settings include time zone, fiscal year, and locale.

The following are the fields within the SubmetricDefinition object:

Field LabelTypeDescription
metric_api_nameStringRequired. The API name of the metric to query.
filtersrepeated SemanticFilterOptional. Array of filters to apply to the metric query.

The following are the fields within the StatusCondition object:

Field LabelTypeDescription
status_nameStringRequired. The name of the status condition.
valueStringRequired. The value to compare against.
operatorSemanticFilterOperatorTypeEnumRequired. The operator for the comparison (equals, greater than, etc.).
is_primaryBooleanOptional. Whether this is the primary status condition. Default: false.

The following are the fields within the SemanticFieldReference object:

Field LabelTypeDescription
tableFieldReferenceSemanticTableFieldReferenceOptional. Reference to a table field that will be used as an additional dimension.
calculatedFieldApiNameStringOptional. The API name of a calculated field. Alternative to tableFieldReference.

The following are the fields within the SortOrder object:

Field LabelTypeDescription
simple_sort_orderSimpleSortOrderOptional. Simple sort order for basic sorting operations.
aggregative_sort_orderAggregativeSortOrderOptional. Aggregative sort order for sorting grouped results.

The following are the fields within the LimitOptions object:

Field LabelTypeDescription
limitint32Required. The maximum number of results to return.

The following are the fields within the SemanticContext object:

Field LabelTypeDescription
timezoneTimezoneRepresents a specific timezone. Valid values and codes can be found in the Supported Time Zones documentation.
localeLocaleRepresents a locale. Locales determine the display formats for date and time, users' names, addresses, and commas and periods in numbers. Valid values can be found in the Salesforce Supported Locales documentation.
currencyCurrencyRepresents a currency for financial calculations and display formatting.