Skip to content

Automatic Modeling and Common Dimensions ​

Version 7.0 supports Automatic Modeling when creating a data package. Data administrators declare business keys through common dimensions. Analysts select fields and metrics, and the system infers the relationships needed for each query without manually creating every main-table and related-table relationship.

This guide is for data administrators and analysts preparing analysis across datasets. Prepare the datasets and obtain the permissions needed to configure the package and edit charts or metrics.

Choose a Modeling Method ​

In Data Mart > Create Data Package > Blank Data Package, enter a name and select a modeling method.

MethodRelationship ConfigurationDatasets Available to Charts and MetricsWhen to Use
Manual ModelingConfigure join conditions, types, and cardinality on the Data Model pageOnly the main table and related tables in an existing data modelYou need direct control over model relationships
Automatic ModelingConfigure dataset mappings and key roles on the Common Dimensions page; queries infer relationshipsAny dataset in the package, without being limited to a predefined main-table/related-table modelDatasets share consistent business keys and should be joined according to the analysis

Automatic modeling lets charts and metrics reference any dataset in the package. Cross-dataset calculations still require valid relationships through common dimensions; the system validates connectivity and infers relationships.

The default is Manual Modeling. The method cannot be changed after creation and is shown in package settings. Existing packages use manual modeling. Copies and packages created from templates retain the source method; older templates without a modeling method use manual modeling. Package cards and table lists display the method.

Automatic modeling packages do not show the Data Model page. Relationships are generated per query and are not saved as an editable main-table/related-table model. For manual modeling, see Data Model Management.

Configure Common Dimensions ​

A common dimension maps fields that represent the same business entity across datasets. For example, a province dataset's province code and a city dataset's province reference code can belong to a common dimension named Province.

Common dimensions support consistent filtering and supply relationship information for automatic modeling. A shared dimension name alone is insufficient: mappings that participate in automatic joins must have key roles.

Create and Edit ​

  1. Open the package's Common Dimensions page and click Create Common Dimension.
  2. Enter a name and description. The name must be unique within the package and cannot be changed when editing a saved dimension.
  3. Under Dataset Mappings, select a dataset, key role, and fields. Enter a role when different business identities must be distinguished.
  4. Click Add Mapping to configure the fields representing the same entity in other datasets.
  5. Check field order and types, then click Confirm. Use the list's three-dot menu to edit or delete a saved common dimension.
SettingMeaning
DatasetA base dataset in the current package, rather than a related-table instance in a model
FieldsThe business key; select one field for a single-field key, or use Add Field for a composite key
Key Role: Unique KeyThe field or field combination uniquely identifies an entity, such as a province code in a province dataset
Key Role: Reference KeyThe field or combination references that entity and may repeat, such as a province code in a city dataset
Empty Key RoleKeeps common-dimension filtering behavior but does not create automatic relationships; an existing key role can be cleared
RoleOptional business identity, such as creator or updater

Key roles declare business semantics; database primary-key or foreign-key constraints are not required. Declare them according to the actual data. Marking duplicate values as unique produces incorrect cardinality assumptions and can affect calculations.

Example: Analyze Cities by Province ​

Prepare province and city datasets in an automatic modeling package, then create a Province common dimension.

DatasetFieldKey RoleRole
ProvincesProvince CodeUnique KeyEmpty
CitiesProvince Reference CodeReference KeyEmpty

After saving, use Province Name from Provinces as a chart dimension and a count of City Code from Cities as a measure. The chart counts cities by province. Neither code needs to appear on a chart axis, and no manual relationship is required.

Composite Keys and Validation ​

If customer codes are unique only within a tenant, identify customers with two fields.

DatasetFirst FieldSecond FieldKey Role
CustomersTenant CodeCustomer CodeUnique Key
OrdersTenant CodeBuyer Customer CodeReference Key

Fields are paired by position: Tenant Code matches Tenant Code, and Customer Code matches Buyer Customer Code. Use the up/down arrows inside each mapping to adjust field order. After adding or removing a field, check every other mapping to preserve matching field counts and positions.

Saving requires the following:

  • Each mapping contains at least one valid field, with no duplicates within that mapping.
  • All mappings in one common dimension have equal field counts and matching types at corresponding positions.
  • A dataset/role combination occurs only once. Use distinct roles for multiple mappings of the same dataset.
  • A field cannot belong to different common dimensions. Fields whose purpose is Measure cannot be common-dimension fields.
  • Values represent the same directly comparable encoding. Matching data types do not make a customer ID and a customer name equivalent keys.

Common dimensions migrated from earlier versions have empty key roles and retain their filtering behavior. Edit the mappings and assign unique or reference keys to enable automatic relationships. Inherited mappings are marked as inherited; their datasets, roles, key roles, and fields are read-only and must be maintained in the source package.

Build Charts with Automatic Modeling ​

  1. Click Start Exploration in the package, or select the automatic modeling package as the data source in a dashboard chart editor.
  2. Click a dataset in the left panel to browse its fields and metrics. The list contains available base datasets in the package; no separate add step is required.
  3. Place fields or metrics into dimensions, measures, or other chart settings. Switch datasets to select additional fields.
  4. Check aggregations, filters, and query results, then save the chart.

Datasets used by the chart move to the top and show a green check. Other datasets remain available. Browsing a dataset alone does not mark it as used. The search control beside the dataset heading searches package datasets. Hover over a name to see its full title, or use the preview icon to open the dataset in a new tab. Clicking an axis locates its dataset and field.

How Relationships Apply ​

The system plans relationships from fields and metrics actually referenced by the chart, including filters, sorting, and indirect metric dependencies. It normally starts from the dataset of the first dimension field; without a dimension, it uses the first aggregate field's dataset.

Relationships can pass through intermediate datasets without placing their fields on the chart. For example, Customers can connect to Products through Orders using configured common dimensions. The intermediate dataset still needs valid mappings.

Reference-to-unique relationships take precedence over unique-to-unique, followed by reference-to-reference. For equal key priorities, shorter paths from the dimension root take precedence, followed by field usage and other selection rules. Different analyses can therefore use different relationship paths within the same package.

Automatic modeling also supports ring models that satisfy shared-relationship rules. For example, Customers and Dates can be unique-key datasets referenced by Orders and Returns, allowing order and return amounts to be analyzed by customer and date. Both common dimensions must be configured; matching field names alone do not establish relationships.

Change the Data Source ​

When an ordinary chart switches to another package and either the old or new source uses automatic modeling, confirming the switch clears its data configuration, including fields, filters, sorting, and drill settings. Rebuild the chart's data settings afterward. Chart type and layout are retained. Cancel the switch to retain the current chart.

This rule applies to changing data sources. Browsing another dataset in the same package does not clear configured axes. Complex Reports continue to use their own data-model configuration.

Use Multiple Roles for One Dataset ​

Roles and HQL role syntax apply only to automatic modeling (AUTO) data packages. Roles have no meaning in manual modeling (MANUAL) or other contexts; do not rely on them to distinguish relationships. Before using these examples, confirm Automatic Modeling in the package settings.

Suppose user contains users and app contains applications with both a creator and an updater. Add these mappings to a User common dimension.

DatasetFieldKey RoleRole
useridUnique KeyEmpty
appcreated_byReference Keycreator
appupdated_byReference Keyupdater

Role names contain 1–64 characters using letters, numbers, or underscores; Chinese letters are supported. Whitespace, punctuation, brackets, control characters, and emoji are not supported. The role input suggests saved roles from the current package and accepts new names. Suggestions reuse names without creating mappings automatically.

Dataset, role, key role, and field settings in the Chinese common-dimension editor

The screenshot uses creator mappings between user and dataset. Add another mapping for the updater; configure app in the same way.

Select a Role in the Axis Menu ​

Choose Role from an automatic modeling chart axis's three-dot menu:

  • Default infers a role from referenced fields. With multiple candidates, it favors candidates reachable from the chart root, then applies relationship priorities, mapping order, and other existing selection rules. Add the intended default mapping earlier.
  • A named role selects that common-dimension relationship. A unique-key dataset can use compatible roles from relevant common dimensions; a reference-key dataset uses its own compatible roles. The menu combines available roles across relevant common dimensions.

Roles work with ordinary and formula axes. If a common-dimension change invalidates a selected role, choose Default to clear it or select a valid role.

Specify a Role in HQL ​

In Edit as Expression, reference a field using:

text
{{dataset_name}}[role].{field_name}

The [role] segment is optional. Omitting it uses default inference. The role must apply to the dataset through common-dimension mappings; an unknown or incompatible role produces an error.

With user.name as a dimension, add these measures to count applications created and updated by each user:

text
count({{app}}[creator].{id})
count({{app}}[updater].{id})

With app.type as a dimension, add these measures to calculate the average ages of creators and updaters:

text
avg({{user}}[creator].{age})
avg({{user}}[updater].{age})

Save the mappings in the table before using either example. The second example also requires an age field in user. Place the role after the dataset name, never after the field name.

Create Metrics Across Datasets ​

Automatic modeling packages support atomic and business metrics across datasets.

  1. Open Metric Management in the dataset that will own the metric. Create or edit a metric.
  2. Select fields or metrics from the editor's dataset list. Available base datasets in the current package are listed, with the metric's owning dataset first.
  3. Write an aggregate expression. Business metrics can also configure constraints, analysis dimensions, a time axis, or a referenced granularity.
  4. Preview and save. The metric stays in its owning dataset even when it references others.

The owning dataset and all calculation dependencies must be connected through common dimensions when saving. Intermediate datasets are allowed. Validation also checks indirect metric references, constraints, analysis dimensions, time dimensions, and referenced granularities.

If saving reports that metric datasets cannot be connected through common dimensions, complete the mappings, key roles, or role configuration and save again. A failed edit preserves the saved definition. Single-dataset metrics, constants, and manual modeling retain their existing behavior.

See Metric Management and Atomic and Business Metrics for general operations.

Disconnected Chart Results and Limits ​

A chart can combine independent results from disconnected datasets using a Cartesian product (Cross Join). This does not infer a business relationship: results with 2 and 3 rows produce 6 combinations rather than matching rows by name.

  • Each component result defaults to a maximum of 1,000 rows. The complete product before pagination defaults to a maximum of 10,000 rows. Actual limits depend on system configuration.
  • Exceeding either limit stops the merge with an error; results are not silently truncated. Narrow filters, reduce dimensions, or configure correct common dimensions. Chart pagination cannot bypass the full-product limit.
  • This path supports independently queryable ordinary axes and component-local filters. Formula axes, window or advanced calculations, detail queries, reference lines, and other restricted settings are unsupported. A single calculation or filter expression spanning disconnected components is also unsupported. Connect the datasets through common dimensions first when these capabilities are needed.
  • Metrics across datasets must be connected when saved; the chart's Cross Join rule does not apply to metric definitions.

Scope and Troubleshooting ​

Automatic modeling packages can be chart data sources, but cannot be inheritance sources in Data Inheritance Management, including when replacing an inheritance source. Select the package directly for charting or start exploration from it. Inheritance of manual modeling packages is unchanged.

SymptomCheck and Action
A common dimension exists but no relationship is inferredCheck key roles on both sides, encoding, and field positions; migrated mappings have no key roles by default
A chart uses the wrong creator/updater relationshipCheck mapping order or explicitly select a role in the axis menu or expression
A role is reported as unavailableCheck spelling, both mappings, and reachable paths; clear an invalid selection and choose again
A metric cannot be saved because datasets are disconnectedInclude the owner, expression, and business configuration dependencies; complete intermediate mappings
A disconnected query exceeds limits or is unsupportedConfigure business relationships or reduce independent results and unsupported calculation settings
A dataset or field is missingCheck that it exists, the user has access, and the field is valid

User Manual for Hengshi Analysis Platform