An atomic metric abstracts the statistical definition and calculation logic of a metric. Dataphin introduces an innovative "design as development" philosophy, where defining a metric also specifies its calculation logic. This approach improves development efficiency and ensures consistent statistical results. This topic shows you how to create an atomic metric.
Prerequisites
A business entity is required. For more information, see Create and manage business entities.
Procedure
In the Dataphin console, click Development in the top navigation bar. The Development page opens by default.
In the top navigation bar, select a project. If your project is in Dev-Prod mode, you also need to select an environment.
In the left-side navigation pane, choose Standard Modeling > Atomic Metric.
In the atomic metric list, click the
icon and select Create Atomic Metric.In the Create Atomic Metric dialog box, configure the parameters.
Configure the parameters in the Basic Information section.
Parameter
Description
Business entity
Select a business entity.
Subject area
Defaults to the subject area of the selected business entity.
English name
When you enter an English name, Dataphin provides real-time suggestions based on predefined word roots from your data standard. You can select a recommended word root as the English name. For more information, see Create and manage word roots.
The English name must meet the following requirements:
Contains only letters, digits, and underscores (_).
Cannot exceed 64 characters in length.
Chinese name
The Chinese name must meet the following requirements:
Can contain any characters.
Cannot exceed 128 characters in length.
Measurement unit
Select the measurement unit for the atomic metric. Options include Monetary Unit, Time Unit, Ratio Unit, Ranking, Object Quantifier, Weight Unit, and Other.
Monetary Unit: Fen (CNY), Yuan (CNY), Ten Thousand Yuan (CNY), Million Yuan (CNY), Ten Million Yuan (CNY), Hundred Million Yuan (CNY), Cent (USD), Dollar (USD), Euro (EUR), Hong Kong Dollar (HKD).
Time Unit: Day, Month, Week, Year, Hour, Minute, Second, Quarter, Millisecond.
Ratio Unit: Decimal, Percentile, Permille.
Ranking: Rank (position).
Object Quantifier: Account, Transaction, Item, Unit, Instance, Person-day, Household, Lot, Sheet, Pack.
Weight Unit: Ton, Kilogram.
Other: Other.
Data type
Select the data type for the atomic metric. Options include string, bigint, double, datetime, timestamp, decimal, Text (varchar, char), Numeric (int, smallint, tinyint, float), Date (date), and Other (boolean, binary).
Metric specification
Enter the metric specification. This is a natural language description of the metric's definition and calculation logic, which helps business users understand how the metric is calculated. For example:
Total Orders: The total number of valid orders from a store, excluding abnormal and incomplete orders. The specification cannot exceed 1,000 characters.Description
Enter a brief description of the atomic metric. The description cannot exceed 1,000 characters.
Configure the parameters in the Calculation Logic section.
You can select the data timeliness and configure the calculation logic for the atomic metric based on your business requirements. Data Timeliness options include Day, Hour, and Minute.
NoteDoris and SelectDB compute engines do not support the Minute option for data timeliness.
Parameter
Description
Source primary table
Select a source table. To maintain modeling standards, you can select only dimension logical tables or fact logical tables.
Statistical period identifier
Specifies the field that indicates the time of an event or business process. This parameter is supported only for process fact logical tables (da tables), rapid fact logical tables (df tables), and dimension logical tables. It is not supported for event fact logical tables (di tables).
Calculation logic
Write the expression that defines the calculation logic for the atomic metric. For example,
count(distinct order_id), whereorder_idis a field in the source logical table model.NoteYou can click a field in the list of available fields to add it to the calculation logic editor.
Is additive
Specifies whether summing the metric (as a derived metric) at the same statistical granularity is meaningful. Generally, metrics that are based on distinct counts are not additive.
For example, summing transaction amounts by user is meaningful. If User A has a transaction amount of 100 and User B has 200, their combined total is 300. However, summing the number of buyers by product is not meaningful. If Product A has 100 buyers and Product B has 50, the total of 150 may be inflated because users who purchased both products are counted twice.
After you configure the parameters, click Save and Submit.
Next steps
If your project is in Dev-Prod mode, you must publish the atomic metric to the production environment. For more information, see Manage publish tasks.
After you create the atomic metric, you can create a derived metric based on it. For more information, see Create a derived metric.