Using Mapped Dimensions

作者 gopigment6fec49f4ce9d無授權條款22 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫2 天前更新

Execution skill. Use when modeling dynamic or time-dependent hierarchies, card metrics for flexible reporting (e.g. headcount by team/function via BY-arrow mappings), or any scenario where reporting breakdowns must differ from the structural dimensions on the metric.

僅含說明Data & Analytics
AI 產生的概覽

說明如何在 Pigment 中使用對應維度與檢視中的聯結樞紐分析,對隨時間變動的階層關係建模。

功能
此技能引導代理在 Pigment 中實作對應維度(隨時間變動的階層)。內容涵蓋如何在靜態維度類型屬性與對應維度之間做選擇、建立對應指標、以公式、手動輸入或匯入方式填入對應,並在檢視中將其作為聯結樞紐分析使用。此外也列出適用範圍與限制、維度轉換情形、最佳實務,以及與其他做法的比較。
適用情境
當父子關係會隨期間或版本變動時使用,例如員工與團隊的按月歸屬、組織調整後的成本中心與部門歸屬。當報表的彙總方式需要不同於指標本身的結構維度時也適用。
執行需求
需要代理能存取文件中提到的 Pigment MCP 工具(create_metric、set_metric_input、create_view、update_view_pivots)。對應值的批次匯入須由使用者在 Pigment 介面中完成。不隨附指令碼。

Using Mapped Dimensions

Mapped dimensions (time-dependent hierarchies, slowly changing dimensions) model parent-child relationships that change across periods. Past periods keep the old parent; future ones reflect the new assignment.

Choose Between Static Properties and Mapped Dimensions

CriterionDimension-Type Property (static)Mapped Dimension (dynamic)
Relationship changes?Rarely or neverChanges over time or by version
History preservationUpdating the parent moves all history with the childEach period retains its own parent assignment
Where it worksMetric formulas, aggregation, viewsViews only (Joined Pivot); core metrics stay lean
ExamplesProduct to Category, Store to RegionEmployee to Team (monthly), Cost Center to Department (re-org), Product to Promotion (seasonal)

Rule of thumb: if the parent-child mapping is the same for all periods, use a dimension-type property. If it varies by Month, Quarter, or Version, use a mapped dimension.

Implement a Mapped Dimension

Step 1 — Create the Mapping Metric

Create a metric with:

  • Data type: Dimension (referencing the target parent dimension).
  • Structure: the source (child) dimension, plus the dimension along which the relationship changes (typically Month; sometimes Version).

Example: Employee Team Mapping structured on Employee x Month, data type Dimension referencing Team. Each cell holds the Team assignment for that employee in that month.

Use tool:create_metric to create the mapping metric.

Step 2 — Populate the Mapping

  • Formula: derive the assignment from other data.
pigment
IF(Month >= 'Employee'.'Transfer Date', 'Employee'.'New Team', 'Employee'.'Original Team')
  • Manual input: use tool:set_metric_input.
  • Import: no public MCP bulk-import for metrics; ask the user to load mapping values in the Pigment UI, or use tool:set_metric_input for small datasets.

Step 3 — Use Joined Pivot in Views

Use tool:create_view then tool:update_view_pivots to add the mapped dimension as a Joined Pivot. Do not add the parent dimension to every underlying metric's structure.

When users view a metric like Salary (structured on Employee x Month), the Joined Pivot through Employee Team Mapping aggregates salaries by Team with each month reflecting the correct assignment.

Scope and Limitations

  • Mapped dimensions work in Views only. Cannot reference them in formulas.
  • Mapping metric consumes storage proportional to child items x periods. Keep manageable.
  • Parent dimension does not become part of metric structure — keeps metrics lean, avoids dimension explosion.
  • BLANK mapping cells mean the child has no parent for that period and won't appear under any parent group in the View.

Dimensional Transformation Interaction

  • Case 0 (no modification): mapping metric has same dimensions as source metric. No transformation needed.
  • Case 1 (aggregation): View aggregates child-level data to mapped parent level. Aggregation operator defined on View pivot.
  • Case 2 (allocation via properties): use static property for fixed allocation; mapped dimension when allocation parent changes over time.
  • Case 3 (add/remove dimensions): mapped dimensions do not add structural dimensions. Parent appears only in the View.

Best Practices

  • Use only when the relationship genuinely varies over time. Static hierarchies are simpler and more performant.
  • Name mapping metrics clearly: [Child] [Parent] Mapping (e.g. Employee Team Mapping).
  • Keep time granularity as coarse as possible (Quarter instead of Month if changes are quarterly).
  • Add Version to mapping metric structure when mapping varies by Version as well.
  • Document re-org dates so users understand why aggregations shift.

Compare with Alternative Approaches

ApproachProsCons
Dimension-type propertyWorks everywhere (formulas, Views); simpleOverwrites history when parent changes
Mapped dimensionPreserves history; no metric restructuringView-only; requires a mapping metric
Separate dimension per periodFull flexibilityDimension explosion; hard to maintain
Boolean flag propertySimple filteringNo aggregation to parent

Mapped dimensions are the standard solution for time-dependent aggregation without restructuring metrics or losing historical assignments.

來源與署名

來源:gopigment/ai-plugins位於skills/using-mapped-dimensions提交6fec49f

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架