All Products
Search
Document Center

Dataphin:Create derived metric

Last Updated:Jan 21, 2025

Derived metrics are essential for defining the scope of atomic metric statistics. This topic describes the steps to create a derived metric.

Procedure

  1. On the Dataphin home page, navigate to Development > Data Development using the top menu.

  2. From the top menu bar, select Project and, if in Dev-Prod mode, also select Environment.

  3. In the left-side navigation pane, choose Standard Modeling > Metrics. Then, in the metrics list on the right, click the image icon.

  4. In the New Derived Metric configuration wizard, at the Define Derived Metric step, set the following parameters.

    Parameter

    Description

    Metric Definition

    Statistical Period

    Select the statistical period for the derived metric. The statistical period defines the time span of the source data for the metric. For example, selecting the last 7 days means that the factual behavioral data for the last 7 days is counted. You can select up to 3 statistical periods.

    Atomic Metric

    Select the atomic metric for the derived metric. The system only supports selecting atomic metrics with the same data timeliness.

    Business Condition

    Select the business filter for the derived metric. The system only supports selecting business filters with the same data timeliness as the selected atomic metric.

    Statistical Granularity Setting

    Statistical Granularity

    The timeliness of the statistical granularity is automatically filled in by the system based on the selected statistical period. You only need to select the object granularity. You can add up to 3 object granularities.

  5. Click Next.

  6. At the Pre-generate Derived Metric step, review the derived metric and click Next.

    Parameter

    Description

    Metric English Name

    The system defaults to pre-generating the metric English name according to <Atomic Metric English Name>_<Statistical Period Abbreviation>_<Business Filter English Name>. You can customize and edit it. The naming convention is as follows:

    • Only English letters, numbers, and underscores (_) are allowed. The first character must be a letter, and the length must not exceed 100 characters.

    • The metric English name must be unique in the aggregate table.

    • The maximum length supported by AnalyticDB PostgreSQL is 50 characters.

    Metric Name

    Automatically generated by the system. You can customize it.

  7. In the Complete Metric Information step, enter the required parameters.

    Parameter

    Description

    Operation Owner

    Select the operation owner for the current derived metric.

    Click Set Operation Owner to support batch modification of the operation owner for all current derived metrics.

    Business Owner

    Select the business owner for the current derived metric.

    Click Set Business Owner to support batch modification of the business owner for all current derived metrics.

    Scan Configuration

    Click image.png to support configuring the scheduling configuration for the derived metric. The scheduling configuration and parameter descriptions supported by derived metrics are as follows:

    • Schedule Type: Derived metrics only support Normal Scheduling.

    • Effective Date: Derived metrics do not support setting an effective date.

    • Recurrence: The system will automatically set the corresponding value based on the statistical period of the derived metric. This includes year, month, week, day, hour, and minute. Year, month, and week are compatible with the system's automatic scheduling cycle and do not support selection. You can achieve year, month, and week scheduling through conditional scheduling.

      Note

      The statistical period of derived metrics is a financial statistical period and does not support modifying the scheduling period of derived metrics by changing the financial statistical period.

    • Scheduling Run Plan: Click Preview. The scheduling run plan displays all scheduling instances and their scheduling types for each day of a certain month according to the configured scheduling period and conditional scheduling. You can choose to preview the date type by Business Date or Run Date (Scheduling Date).

      If there are multiple scheduling type statuses for all instances in one day, all scheduling type statuses contained are displayed by color, and the name of each scheduling type status and the number of corresponding instances are displayed. For example, the figure below shows that on the 4th of a certain month, the current scheduling task has 44 normal scheduling instances, 2 paused instances, and 12 dry-run instances. image

      Hover the mouse over a scheduling type module on a certain day to view the detailed scheduling instance list for the current scheduling task on that day, including scheduling type, scheduling condition, and condition name.

    • Conditional Scheduling: After enabling conditional scheduling, you can set multiple groups of scheduling conditions. You can add up to 10 scheduling conditions. The system will perform condition checks in order from top to bottom. Once a condition is hit, the corresponding scheduling action is executed, and all subsequent condition checks are stopped. If no conditions are hit, the default scheduling configuration is executed.

      Important

      Conditional scheduling is only effective when the scheduling type is Normal Scheduling.

      1. Click +add Scheduling Condition.

      2. In the Edit Conditional Scheduling dialog box, configure the relevant information for conditional scheduling.

        • Condition Name: Supports any character, with a length of up to 32 characters.

        • Effective Status: Enabled by default. When disabled, the conditional scheduling will be ignored during scheduling.

        • Meet the Following Conditions: The judgment rule for the condition. When the condition is true, scheduling is performed according to the configuration information of Execute Scheduling. For configuration instructions, see Conditional Scheduling Rule Description.

        • Execute Scheduling: Supports custom and follow scheduling properties:

          • Custom: When the condition is true, scheduling is run according to the configured Scheduling Type.

          • Follow Scheduling Properties: Consistent with the scheduling policy in the scheduling properties, equivalent to the scheduling settings when conditional scheduling is disabled.

        • Scheduling Type: For configuration instructions, see the above Scheduling Type.

      3. Click OK.

        After completing the conditional scheduling settings, click Preview Scheduling Run Plan to view the dates hit by conditional scheduling in the calendar.

        Important
        • After modifying the conditional scheduling settings, submitting and publishing to the production environment will take effect in real-time for instances in the Not Running status at the time of publication. It will not take effect for instances that have entered the Waiting for Run Time status.

        • When using cross-node parameter judgment types in conditional scheduling, you must provide possible parameter values for preview.

    • Upstream Dependency: The system will generate upstream dependencies based on the derived metric. Modification or deletion is not supported. When modifying the dependency period, if the time unit of the modified dependency period is smaller than the data timeliness time unit of the derived metric, the system will automatically add self-dependency for this node.

    Description

    Provide a brief description of the derived metric, within 1000 characters.

  8. To submit, click Submit, provide the Submission Remarks, and then click Confirm And Submit to finalize the creation of the derived metric.

What to do next

If the project is in Dev-Prod mode, you must publish the derived metric to the production environment. For more information, see Manage Release Tasks.