A derived metric is composed of an atomic metric, a period, and one or more modifiers. A derived metric reflects the status of a business activity within a specific period and a specific scope. For example, you can use a derived metric to measure the sales amount of last week for an enterprise in Shanghai. This topic describes how to create and manage a derived metric.

## Prerequisites

• Atomic metrics are created to define criteria and computing logic for the statistical analysis of business activities. For more information about how to create an atomic metric, see Atomic metric.
• Modifiers are created to define scopes for the statistical analysis of business activities. For more information about how to create a modifier, see Modifier.
• Periods are created to define the periods of time for the statistical analysis of business activities. For more information about how to create a period, see Period.
• Dimension tables are created to define the statistical dimensions of business activities. For more information about how to create a dimension table, see Create a dimension table.
• Data domains are created to classify your business data by data domain to support the statistical analysis at the common layer. For more information about how to create a data domain, see Data domain.
• Data marts or subject areas are created to associate derived metrics when you create the derived metrics at the application layer. A data mart or subject area reflects the status of a business activity. For more information about how to create a data mart and a subject area, see Data mart and Subject area.

## Background information

A derived metric collects statistics on the status of a business activity of an enterprise. A derived metric is composed of an atomic metric, a period, and one or more modifiers. A derived metric can reference only one atomic metric and collects statistics on the values of the atomic metric within a specific period based on specific business conditions.
• An atomic metric determines a criterion and a computing logic for the statistical analysis of a business activity. For example, you can use the total number of orders as an atomic metric.
• A modifier defines the scope of a business activity. For example, you can use online fresh shops and offline fresh shops as modifiers.
Note A derived metric can contain one or more modifiers.
• A period defines the time range within which you want to collect statistical data. For example, you can use a calendar day as a period.
• A derived metric is composed of an atomic metric, a period, and one or more modifiers. A derived metric is used to collect statistical data on the values of an atomic metric within a specific period based on specific dimensions and business conditions. A derived metric reflects the status of a business activity of an enterprise. For example, you can create a derived metric to collect statistical data on `the total number of orders that are placed in online fresh shops on a calendar day` or ```the total number of orders that are placed in online and offline fresh shops on a calendar day```.
You can associate fields in one or more dimension tables with a derived metric. This way, you can perform statistical analysis on a business activity based on one or more dimensions. For more information about how to create a dimension table, see Create a dimension table.

## Go to the Derived Metric page

Go to the Derived Metric page.
1. Log on to the DataWorks console.
2. In the left-side navigation pane, click Workspaces.
3. In the top navigation bar, select the region where the workspace that you want to manage resides. On the Workspaces page, find the workspace and click Data Development in the Actions column.
4. On the DataStudio page, click the icon in the upper-left corner and choose All Products > Data Modeling > Data Metric. The Derived Metric page appears.
You can select a data layer category to create a derived metric based on your business requirements.
• Common Layer: A derived metric is created based on a data domain, and is used to construct reusable aggregate data for data analysis and statistics collection. You can specify a data domain and create a derived metric based on the data domain.
• Application Layer: A derived metric is created based on a business category, and the derived metric is used to collect statistics on specific application scenarios or specified products. You can specify a business category and create a derived metric based on the business category.
On the Derived Metric page, you can create a single derived metric or create multiple derived metrics at the same time. In most cases, the business activities of an enterprise are complex and diverse, and the enterprise wants to analyze the status of multiple business activities based on different periods, different scopes, and a definite data domain or business category at the same time. We recommend that you create multiple derived metrics for a specific type of business activity. For more information about how to create multiple derived metrics at the same time, see Create multiple derived metrics at the same time. For more information about how to create a single derived metric, see Create a single derived metric.

## Create multiple derived metrics at the same time

1. On the Derived Metric page, move the pointer over the icon and select Multiple Derived Metrics.
2. Create a metric model that is used to generate multiple derived metrics at the same time.
1. On the configuration tab that appears, select atomic metrics, modifiers, and periods and configure the order in which the atomic metrics, modifiers, and periods are displayed in the render tree.
Section Description
1 In this section, you can configure the order in which atomic metrics, modifiers, and periods are displayed in the render tree. The render tree is displayed in Section 3.
2 In this section, you can select atomic metrics, modifiers, and periods. Then, you can preview the derived metrics to be created in Section 3.
Note
• If the existing atomic metrics, modifiers, or periods do not meet your business requirements, you can click Create next to Atomic Metric, Modifier, or Period to create atomic metrics, modifiers, or periods based on your business requirements.
• A derived metric is composed of an atomic metric, a period, and one or more modifiers.
3 In this section, a render tree is displayed to show all of the derived metrics to be created at the same time. A derived metric that is displayed in the render tree is in one of the following states:
• : indicates that the derived metric does not exist in the current business process, data mart, or subject area.
• : indicates that the derived metric already exists in the current business process, data mart, or subject area. When you generate the derived metrics, the system filters out the existing derived metrics from the current business process, data mart, or subject area.
4 In this section, you can change the display mode of the render tree. For example, you can zoom in, zoom out, or center the render tree or present the render tree in full screen.
2. Click Generate Derived Metrics.
3. Generate derived metrics at the same time.
1. Configure basic information.
In the Configure Basic Information step, specify the basic information of the derived metrics.
Parameter Description
Data Layer
The data layer to which the derived metrics belong.
• DWS: You can select this option if you want to use the derived metrics to construct reusable aggregate data for data analysis and statistics collection.
• ADS: You can select this option if you want to use the derived metrics to collect statistics on specific application scenarios or specified products.
In the preceding figure, Data Layer is set to DWS.

The business process to which the derived metrics belong. This parameter is used to determine the type of the business activity at the common layer. This parameter is required only if you set Data Layer to DWS.

Mart/Subject

The data mart or subject area to which the derived metrics belong. This parameter is used to determine the type of the business activity at the application layer. This parameter is required only if you set Data Layer to ADS.

Associated Dimension Table
The dimension table and dimension fields that you want to associate with the derived metrics. Select the dimension table that you want to associate with the derived metrics, select the fields in the dimension table, and then click Add. To associate multiple dimension tables with the derived metrics, repeat this step. This parameter can be used to analyze the status of a business activity based on the specified dimensions in an aggregate table or application table.
Note The fields that you select are associated with all derived metrics that need to be created.
2. Click Next.
3. Select the derived metrics that you want to generate.
1. In the Select Derived Metrics step, select derived metrics from the created metric model based on your business requirements. By default, all derived metrics in the metric model are selected.
Note The system filters out the derived metrics that already exist in the current business process, data mart, or subject area.
2. Click Create to create the derived metrics.
4. In the Create Derived Metric step, view the created derived metrics.
You can view the information about the created derived metrics in the Create Derived Metric step. The information includes metric codes and states.
After a derived metric is created, the state of the metric in the render tree changes from to.

## Create a single derived metric

1. Select an operation type.
On the Derived Metric page, move the pointer over the icon and select Derived Metric.
2. Create a derived metric.
Parameter Description
Period The period of time for which you want to perform statistical analysis of a business activity. Examples: last day and last week.

Select a period from existing periods. For more information about how to create a period, see Period.

Modifier The scope for the statistical analysis of a business activity. Examples: online and offline.

Atomic Metric The atomic metric that is used to define a criterion and computing logic for the statistical analysis of a business activity. Example: order amount.

Select an atomic metric from existing atomic metrics. For more information about how to create an atomic metric, see Atomic metric.

Associated Dimension Table The dimension table and dimension fields that are used to define the dimensions from which a business activity is analyzed. Examples: commodity dimension and shop dimension.

Select fields from an existing dimension table. For more information about how to create a dimension table, see Create a dimension table.

The derived metric and the fields that you associate with the derived metric are used as the statistical fields in an aggregate table or application table. The statistical fields can be used for analysis result display such as reports. You can associate each derived metric with n dimension fields. In theory, the number of dimension field combinations that are used as statistic granularities for a derived metric is `2 to the power of n`. For example, the derived metric is the `order amount for an online shop in the last 24 hours`, and the derived metric is associated with the commodity and shop dimensions. The following statistic granularities can be generated:
• `Online order amount in the last 24 hours`
• `Order amount for an online commodity in the last 24 hours`
• `Order amount for an online shop in the last 24 hours`
• `Order amount for an online commodity in an online shop in the last 24 hours`
The statistic granularity that is used by an aggregate table or application table varies based on the dimension that you select. For more information, see Create an application table.

Select the dimension table that you want to associate with the derived metric, select the fields in the dimension table, and then click Add. To associate multiple dimension tables with the derived metric, repeat this step.

2. Configure basic information.
Parameter Description
Data Layer
The data layer to which the derived metrics belong.
• DWS: You can select this option if you want to use the derived metrics to construct reusable aggregate data for data analysis and statistics collection.
• ADS: You can select this option if you want to use the derived metrics to collect statistics on specific application scenarios or specified products.
In the preceding figure, Data Layer is set to DWS.

The business process to which the derived metrics belong. This parameter is used to determine the type of the business activity at the common layer. This parameter is required only if you set Data Layer to DWS.

Mart/Subject

The data mart or subject area to which the derived metrics belong. This parameter is used to determine the type of the business activity at the application layer. This parameter is required only if you set Data Layer to ADS.

Metric Code The unique identifier that the system generates for the derived metric.
Display Name The display name of the derived metric. You can click Intelligent Recommendation on the right side of Display Name to generate a display name in the `Period_Modifiers_Atomic metric name` format. The generated display name helps you understand the statistics of the derived metric in an efficient manner.
Note The Intelligent Recommendation button appears only after you configure the Period and Atomic Metric parameters in the Business Logic section.

The display name can contain letters, digits, underscores (_), ampersands (&), and parentheses () and must start with a letter or digit.

Name The name of the derived metric.
Note The Intelligent Recommendation button appears only after you configure the Period parameter in the Business Logic section.

The name can contain letters, digits, underscores (_), and ampersands (&) and must start with a letter or digit.

Description The description of the derived metric.
3. Click Save. The derived metric is created.

## Manage a derived metric

On the Derived Metric page, double-click the Derived Metric folder in the left-side navigation tree, or click the icon to view all derived metrics. You can also perform the following operations on the derived metrics.
• Edit a derived metric.
Find the derived metric that you want to edit and click Edit in the Actions column to go to the configuration tab of the derived metric. On the configuration tab, you can modify the information about the derived metric, such as Period, Modifier, and Business Process.
Note If the derived metric is associated with an aggregate table, you cannot modify Period and the fields that are associated with the derived metric and used in the aggregate table. If you want to modify Period and the fields, you must disassociate the fields from the derived metric in the aggregate table first.
• Delete a derived metric.
Find the derived metric that you want to delete and click Delete in the Actions column.
Note If an aggregate table is associated with the derived metric, you must disassociate the aggregate table from the derived metric before you can delete the derived metric.

## What to do next

After you create the derived metrics, you can analyze the statistics of derived metrics of the same period and same dimensions in the data domain in an aggregate table or application table. The name of a derived metric and the name of a field that is associated with the derived metric are combined and used as the name of a field in the aggregate table or application table. This aggregate table or application table can be used in subsequent business queries, online analytical processing (OLAP) analysis, and data distribution. For more information about how to associate an aggregate table and application table with a derived metric, see Create an application table.