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 从公开仓库中收录这些内容。

举报或申请下架