Create an atomic metric
An atomic metric is an abstraction of a metric's statistical definition and calculation logic. Dataphin uses a "design-as-development" approach, where defining a metric also specifies its calculation logic. This approach improves development efficiency and ensures consistent results. This topic explains how to create an atomic metric.
Prerequisites
You have created a business entity. For more information, see Create and manage business entities.
Procedure
On the Dataphin homepage, click R&D in the top menu bar. You land on the Develop page by default.
In the top menu bar, select a Project. If you are in Dev-Prod mode, you also need to select an Environment.
In the left-side navigation pane, choose Standardized Modeling > Atomic Metrics.
In the list of atomic metrics, 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 object or business activity.
Subject area
The subject area where the business entity resides is selected by default.
English name
As you enter the English name, Dataphin provides real-time suggestions based on pre-configured root words. You can select a recommended root word for the business entity. For more information, see Create and manage root words.
The English name must meet the following requirements:
It can contain only letters, digits, and underscores (_).
It cannot exceed 64 characters.
Chinese name
The Chinese name must meet the following requirements:
It can contain any characters.
It cannot exceed 128 characters.
Unit of measure
Select a unit of measure for the atomic metric. Options include Currency unit, Time unit, Ratio unit, Ranking, Object quantifier, Weight unit, and Others.
Currency 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: household, transaction, item, unit, time, person-day, company, hand, piece, package.
Weight unit: ton, kilogram.
Others: Others.
Data type
Select a data type for the atomic metric. Options include string, bigint, double, datetime, timestamp, decimal, Text (varchar, char), Numeric (int, smallint, tinyint, float), Date and time (date), and Others (boolean, binary).
Metric definition
Enter the metric definition in natural language to help business users understand its calculation logic. For example:
Total Orders: The total number of valid orders from stores, excluding abnormal and incomplete orders. The definition 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.
Based on your business requirements, you can select a data recency and configure the calculation logic for the atomic metric. Data Recency options include Day, Hour, and Minute.
Parameter
Description
Source primary table
Select a source table. To ensure standardized modeling, only a dimension logical table or a fact logical table can be selected.
Statistical period identifier
Specifies the time field for a specific event or business process. This is only supported 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 from the source logical table model.NoteClick a field in the available list to add it to the calculation logic editor.
Additive
Specifies whether a derived metric can be meaningfully aggregated (summed) across the same statistical grain. Generally, metrics calculated with distinct counts are not additive.
For example, summing sales amounts by customer is meaningful. If Customer A's sales are 100 and Customer B's are 200, their combined sales are 300. However, summing the number of buyers by product is not meaningful. If 100 people bought Brand A phones and 50 people bought Brand B phones, the sum of 150 may be inflated because someone who bought both products would be counted twice.
After you configure the parameters, click Save and Commit to submit the atomic metric.
Next steps
If your project is in Dev-Prod mode, publish the atomic metric to the production environment. For more information, see Manage publishing tasks.
After you create the atomic metric, you can create derived metrics based on it. For more information, see Create a derived metric.