The online Trailblazer Community becomes read-only Oct 30, 2026. Read More
Filters in Semantic Metric Queries allow you to refine your metric results by applying conditions to the data. While metric queries are primarily focused on predefined metrics, you can still apply filters to the underlying data to get more targeted results.
1{
2 "structuredMetricQuery": {
3 "time_range": {
4 "fieldName": "SemanticAccount_SDO.CreatedDate",
5 "operator": "Between",
6 "value": "2023-06-01 | 2023-06-30"
7 },
8 "submetric_definition": {
9 "metric_api_name": "AnnualRevenueAmountPerName_md"
10 },
11 "model_api_name": "AccountSDM",
12 "semantic_context": { // context
13 }
14 },
15 "semanticModelId": "2SMxx0000004CAeGAM"
16}Performance: Use
Betweenfor a range instead of separateGreaterThanOrEqualandLessThanOrEqualconditions; a single range predicate lets the engine prune partitions on date and numeric columns.
1{
2 "structuredMetricQuery": {
3 "submetric_definition": {
4 "metric_api_name": "AnnualRevenueAmountPerName_md",
5 "filters": [
6 {
7 "fieldName": "SemanticAccount_SDO.Name",
8 "operator": "Equals",
9 "value": "MyName"
10 }
11 ]
12 },
13 "model_api_name": "AccountSDM",
14 "semantic_context": { // context
15 }
16 },
17 "semanticModelId": "2SMxx0000004CAeGAM"
18}1{
2 "structuredMetricQuery": {
3 "filters": [
4 {
5 "fieldName": "SemanticAccount_SDO.CreatedDate",
6 "operator": "GreaterThanOrEqualTo",
7 "value": "2024-01-01"
8 }
9 ],
10 "submetric_definition": {
11 "metric_api_name": "AnnualRevenueAmountPerName_md"
12 },
13 "model_api_name": "AccountSDM",
14 "semantic_context": { // context
15 }
16 },
17 "semanticModelId": "2SMxx0000004CAeGAM"
18}