You are reading the documentation for an outdated Corteza release. 2024.9 is the latest stable Corteza release.

Metric

A metric page block is quite similar to chart page blocks in the sense, that they present a metric based on the namespaces data. The difference is that a metric page block displays the defined metric in plain text, as a number with some additional formatting options. This can be used to show information, such as the number of new opportunities, total number of leads this month, etc.

Definition

A metric page block consists of a set of metrics. Each metric defines:

Label

A user friendly name that identifies what the metric shows,

Dimension Module

The module that will be used as a data source,

Dimension Filter

Any additional filtering that should be performed on the output value,

Metric Field

What field should be used when calculating the final value, such as the number of records, the cost associated with the record, …​

Metric Aggregation operation

Determines how the data should be aggregated into a single value. The available options are:

  • Count: the number of matched records,

  • sum: the value sum from the specified metric field,

  • max: the maximum value from the specified metric field,

  • min: the minimum value from the specified metric field,

  • avg: the average value from the specified metric field.

Metric Transform value

Additional operations to perform over the computed value, such as rounding, calculating percentages, etc. See below Examples for examples,

Metric Number format

Determines the formatting to be used when displaying the final result. See Numeral.js format for available number formatting,

Metric Prefix

Determines the prefix to be used when displaying the final result,

Metric Suffix

Determines the suffix to be used when displaying the final result,

Style Text color

Determines the color of the final result,

Style Background color

Determines the background color of the final result,

Style Font size

Determines the font size of the final result. Value is specified in pixels.

Examples

Divide result by 1000 to show cost in thousands

v / 1000

Round result to remove decimal places

Math.round(v)

Round result to remove decimal places (round up)

Math.ceil(v)

Round result to remove decimal places (round down)

Math.floor(v)

Round result to two decimal places

Math.round(v * 100) / 100

The used interface uses standard JavaScript syntax, so any operation achievable in standard JavaScript is also achievable here.

Rounding can already be achieved by using value format.