MicroStrategy ONE

Creating a simple metric

Metrics can be either simple or compound. A simple metric consists of a formula and a level:

  • The formula of a simple metric is a mathematical expression based on at least one group function (such as sum or average) applied to facts, attributes, or metrics. A simple metric can also contain non-group functions or arithmetic operators, in addition to the required group function. It defines the data to be used and the calculations to be performed on the data. Examples of simple metric formulas are Sum(Revenue) and Sum(Cost + Revenue), where Cost and Revenue are both facts.

    A value prompt can also be part of the formula. For example, you can use a prompt in a price metric to allow a user to specify a discount at run time. The prompt asks the user for a percentage, which is used in the metric to reduce the price. The formula of this metric is Sum(Cost * ?Discount), where Cost is a fact and Discount is a value prompt. The question mark indicates that Discount is a prompt.

    If a metric contains non-group functions or arithmetic operators without a group function, it is a compound metric.

  • The level, or dimensionality, is the level of calculation for the metric, such as year or customer. By default, the metric is calculated at the lowest attribute level of any report that it is placed on. This is referred to as the report level. For more information on levels in metrics, see About level metrics.

Simple metrics can also contain their own filters, separate from any report filters; these is referred to as conditionality. Simple metrics can use offset values, such as "four months ago", called transformations. These are not required components, as are the formula and level. A simple metric does not restrict you to simple calculations; the term simple only refers to its structure. You can create complex metrics that contain levels, a condition, and transformations.

For additional information and examples of metrics, see the Creating a Query chapter in the Basic Reporting Help. For more information on simple metrics that contain levels, conditions, or transformations, see About level metrics, About conditional metrics, or Creating transformation metrics.

Prerequisite

This procedure assumes a basic understanding of metrics, and in particular, simple metrics, as described above.

To create a simple metric

  1. Open the Metric Editor. (How?)

  2. If the Object Browser (the list of folders and objects) is not displayed, select Object Browser from the View menu.

  3. Use the Object Browser to locate a fact, attribute, or metric to serve as the base formula for the metric. Double-click the object. The Metric component pane (located at the top right) displays default values for each of the metric components (Formula, Level, Condition, and Transformation).

    • For example, in the Tutorial project, double-click the fact Revenue. The metric definition changes from "Metric definition is empty" to "Sum(Revenue){ReportLevel}". The formula is Sum(Revenue), the level is report level, the condition is empty, and the transformation is empty.

      Sum is the default function for a fact and Count is the default function for an attribute.

  4. To modify the formula, click Formula to identify the facts to which the metric is applied and the type of aggregation the metric is to have. Enter values for this component as follows:

    • Select operators and delimiters from the operator bar (( ), +, -, *, and /), as applicable, to define (or redefine) the metric.

    • To delete the metric formula and begin again, click Clear.

    • Click Validate to check the validity of your newly defined metric. The Metric Editor displays the Validation status at the bottom of the Definition pane.

  5. By default, the metric is calculated at the report level, meaning that the attributes on the report template dictate how the metric is aggregated. However, you can change the level (dimensionality) of the calculation. (How?)

  6. By default, the metric's condition is set to nothing, which means that a filter is not applied to it. You can specify the filters, or conditionality, to apply to the metric. (How?)

  7. By default, the metric does not include transformations, or offset values, such as "four months ago". However, you can add transformations. (How?)

  8. When you have completed the metric definition, select it under Metric New Metric is defined as, then click Validate. The Metric Editor displays a status message, at the bottom of the Definition pane, showing whether the new metric definition is correct (Valid expression).

  9. Click Save and Close on the Metric Editor toolbar. The Save As dialog box opens.

  10. Select the folder in which to save the new metric.

  11. Enter the name of the new metric and click Save. You are returned to MicroStrategy Developer.

    When naming a MicroStrategy object, you must follow the naming convention rules for your particular database platform. Using a word reserved by your database platform may result in an error. Refer to your database documentation for a list of these database-reserved words.

Related Topics