Skip to main content
Version: Next

ChartDataAdhocMetricSchema

aggregatestring

Aggregation operator.Only required for simple expression types.

Possible values: [AVG, COUNT, COUNT_DISTINCT, MAX, MIN, SUM]

column object
column_namestring

The name of the target column

Example: mycol
typestring

Type of target column

Example: BIGINT
expressionTypestringrequired

Simple or SQL metric

Possible values: [SIMPLE, SQL]

Example: SQL
hasCustomLabelboolean

When false, the label will be automatically generated based on the aggregate expression. When true, a custom label has to be specified.

Example: true
isExtraboolean

Indicates if the filter has been added by a filter component as opposed to being a part of the original query.

labelstring

Label for the metric. Is automatically generated unlesshasCustomLabel is true, in which case label must be defined.

Example: Weighted observations
optionNamestring

Unique identifier. Can be any string value, as long as all metrics have a unique identifier. If undefined, a random namewill be generated.

Example: metric_aec60732-fac0-4b17-b736-93f1a5c93e30
sqlExpressionstring

The metric as defined by a SQL aggregate expression. Only required for SQL expression type.

Example: SUM(weight * observations) / SUM(weight)
timeGrainstring

Optional time grain for temporal filters

Example: PT1M
ChartDataAdhocMetricSchema
{
"aggregate": "AVG",
"column": {
"column_name": "mycol",
"type": "BIGINT"
},
"expressionType": "SQL",
"hasCustomLabel": true,
"isExtra": true,
"label": "Weighted observations",
"optionName": "metric_aec60732-fac0-4b17-b736-93f1a5c93e30",
"sqlExpression": "SUM(weight * observations) / SUM(weight)",
"timeGrain": "PT1M"
}