Fields - Measure
Measure
Measure is used to perform aggregate functions in SQL (count, SUM, AVG, etc.) on multiple rows of a column.
Measures must reference dimensions.
fields: #begin of fields section (inside View or Model)
- measure: measure_name
hidden: false
label: 'field label in UI'
description: 'description in UI'
type: measure_type
result: measure_result
format_number: '$,.0f'
currency_prefix: $
currency_suffix: ''
sql: BlockML reference of dimension (to be aggregated)
#for measure of type '*_by_key':
sql_key: BlockML reference of dimension (to be used as distinct key)
#for measure of type 'percentile_by_key':
percentile: 80
Measure Parameters
Name | Type | Default | Description |
---|---|---|---|
measure* | string | - | Field name |
label | string | - | Override field name in UI |
hidden | boolean | false | Hide field in UI |
description | string | - | Field description in UI |
type* | enum | - | Measure type:
|
result | enum | "number" | Resulting data type (after all SQL transformations, including aggregation function itself implicitly):
|
sql* | string | - | Way to calculate field through SQL expression (must be a BlockML reference of dimension) |
sql_key** | string | - | (for measure of type sum_by_key, average_by_key, median_by_key, percentile_by_key) Must be a BlockML reference of dimension |
percentile** | integer | - | (for measure of type percentile_by_key) Specify the fractional value (the Nth percentile) between 1 and 99 |
format_number | string | - | Format Number |
currency_prefix | string | - | Format Number - Symbol |
currency_suffix | string | - | Format Number - Symbol |