Data Modeling

Multiple units of measure in facts are safe only when the model separates the original recorded quantity from explicitly defined reporting measures. The mistake to avoid is summing a generic quantity column that mixes cases, eaches, pounds, kilograms, liters, hours, or other units without a shared physical meaning and conversion rule.

Why unit mistakes happen in fact tables

Unit mistakes usually start with a harmless-looking column named quantity. In the source system, that column may mean two cases on one row, twelve eaches on another row, five pounds on another row, and two kilograms somewhere else. Each row is valid at transaction grain, but the column is not automatically additive across rows.

The problem is not that a fact table contains different units. Operational systems often record activity in the unit that made sense at the time of sale, shipment, manufacturing, or inventory movement. The problem is letting a reporting tool sum those values as if they describe the same physical quantity.

A safe dimensional model makes the physical meaning visible. It answers three questions before aggregation:

  • What is being measured: count, mass, volume, length, time, area, or another measurement family?
  • What canonical unit is used for reporting?
  • What conversion rule was used, and is that rule valid for this product, date, and business process?

Start with grain and the measured physical quantity

Before choosing columns, declare the fact table grain. For example: one row per shipment line. Then define each measure at that grain.

At shipment-line grain, these are different measures:

  • source_quantity: the number recorded by the operational event, in the original source unit.
  • quantity_each: a standardized count of individual selling units, when the item is countable.
  • net_weight_kg: a standardized mass measure.
  • volume_liters: a standardized volume measure.

Those columns should not be treated as interchangeable. A bottle count is not a weight. A weight is not a volume. A case count is not an each count unless a product-specific pack conversion has been applied.

The practical naming rule is simple: additive reporting measures should say both the business concept and the unit. Names like net_weight_kg and volume_liters are harder to misuse than quantity.

Operator rule

A fact table may contain many units, but a summable measure should have one physical meaning and one reporting unit.

A dimensional schema pattern for multiple units of measure

A durable pattern is to keep the original unit on the fact row and expose separate standardized facts for reporting. The original value preserves traceability. The standardized value gives analysts a safe additive measure.

A typical model includes:

  • Fact table: one row at the declared business grain, such as shipment line, order line, production event, or inventory movement.
  • Unit of measure dimension: describes the source unit, such as each, case, pound, kilogram, liter, pallet, meter, or hour.
  • Measurement family attribute: identifies whether the unit represents count, mass, volume, length, time, or another family.
  • Conversion rule table or dimension: records the rule used to translate a source unit into a canonical reporting unit.
  • Standardized additive measures: separate columns such as quantity_each, net_weight_kg, gross_weight_kg, volume_liters, or duration_minutes.

The unit dimension is descriptive; it does not make aggregation safe by itself. Safety comes from the measure definition and the conversion rule. A report can group by unit, but it should not sum a mixed-unit source quantity unless the grouping keeps the quantities physically compatible.

Important distinction

A unit of measure dimension describes the original unit. It does not make a mixed quantity column safe to aggregate.

Model object Example fields Purpose
Fact shipment line shipment_line_key, date_key, product_key, source_quantity, source_uom_key, quantity_each, net_weight_kg, volume_liters, conversion_rule_key Stores original transaction quantity and safe additive reporting measures at the declared grain.
Unit of measure dimension uom_key, unit_code, unit_name, measurement_family, canonical_unit_code Describes whether the source unit is a count, mass, volume, length, time, or other family.
Conversion rule table conversion_rule_key, product_key, from_uom_key, to_uom_key, factor, effective_start_date, effective_end_date, status Records how a source unit becomes a reporting unit, including product-specific and time-aware rules.
Product dimension product_key, product_name, package_type, base_selling_unit Provides the product context needed for pack, case, pallet, or each conversions.

Hypothetical example: shipment lines with reconciled measures

Consider a shipment-line fact table. The source system records the unit used on the shipment document. Reporting users want total bottles shipped, total shipped weight, and total shipped volume.

At the source level, these rows all have a valid source quantity. But summing source_quantity would produce a misleading result because the rows use different units.

In the dimensional model, the fact table keeps source_quantity and source_uom for auditability. It also stores reconciled measures using explicit reporting units: quantity_each, net_weight_kg, and volume_liters.

For the example, assume a water case contains 24 bottles, each bottle is 0.5 liters, and the simplified net weight is 0.5 kilograms per bottle. Assume flour can be measured by weight, with pounds converted to kilograms. These assumptions are for illustration only; real conversion rules should come from governed product and unit reference data.

Line Product Source quantity Source UOM Reconciled quantity_each Reconciled net_weight_kg Reconciled volume_liters
1 Water bottle 2 case 48 24 24
2 Water bottle 12 each 12 6 6
3 Flour bag 5 pound 2.268
4 Flour bag 2 kilogram 2

What the reconciled measures allow you to aggregate

The incorrect query is the tempting one: SUM(source_quantity). In the example, that would add 2 cases, 12 eaches, 5 pounds, and 2 kilograms to get 21. The number 21 has no physical meaning.

The correct reporting measures are more specific:

  • Total bottles shipped: sum quantity_each only for products where the each measure is defined. In the example, water totals 60 eaches.
  • Total net weight shipped: sum net_weight_kg across rows where net weight is defined. In the example, the total is 34.268 kilograms.
  • Total liquid volume shipped: sum volume_liters for rows where liquid volume is defined. In the example, water totals 30 liters.

The important point is not the exact numbers. The important point is that each total has a physical meaning, a canonical unit, and a documented conversion path.

Question Unsafe calculation Safe calculation Result in the hypothetical example
How much source quantity shipped? SUM(source_quantity) across all rows Do not calculate this as a broad total 21 is not meaningful
How many water bottles shipped? SUM(source_quantity) for water SUM(quantity_each) for water rows 60 eaches
What net weight shipped? SUM(source_quantity) across mass and non-mass rows SUM(net_weight_kg) where defined 34.268 kg
What liquid volume shipped? SUM(source_quantity) for water rows SUM(volume_liters) where defined 30 liters

Conversion rules are part of the data model, not spreadsheet cleanup

Some conversions are universal enough to be handled as reference data. For example, pounds to kilograms is a mass conversion. Other conversions are product-specific. A case of one product may contain 12 units, while a case of another product contains 24. A pallet may contain different quantities by product, region, packaging version, or effective date.

That is why conversion logic should be modeled, versioned, and visible. Useful conversion metadata includes:

  • source unit and target unit
  • measurement family
  • conversion factor or formula
  • product or packaging context, when needed
  • effective start and end dates
  • conversion status, such as exact, estimated, missing, or not applicable

If the conversion rule changes over time, the fact should either store the standardized value calculated at load time or reference the exact conversion rule that was applied. Otherwise, historical reports may shift when reference data changes.

Query and semantic rules that prevent unsafe totals

A clean schema still needs guardrails in the BI layer or semantic layer. If a generic source quantity is exposed as a default summable measure, users will eventually sum it incorrectly.

Safer exposure rules include:

  • Hide or clearly label source_quantity as an audit field, not a default metric.
  • Expose additive measures only when their unit is explicit in the metric name.
  • Define default aggregations for standardized measures, not for mixed-unit source quantities.
  • Require filters or grouping by measurement family when users inspect source units.
  • Use nulls where a standardized measure is not applicable, rather than forcing a zero that may hide modeling errors.

For example, a dashboard tile named Total Quantity is usually too vague. A tile named Bottles Shipped, Net Weight Shipped Kg, or Volume Shipped Liters is easier to validate and harder to misuse.

When not to force a conversion

Not every unit should be converted into every other unit. A model becomes less trustworthy when it invents conversions that the business cannot defend.

Do not force a conversion when:

  • the units belong to different measurement families, such as count and mass, unless a product-specific business rule defines the relationship
  • the conversion depends on missing product packaging data
  • the conversion changes by lot, batch, density, moisture, temperature, or another condition that is not available at fact grain
  • the business uses the original unit as the contractual or operational truth
  • the standardized number would imply precision that the source process does not support

In those cases, it is better to leave the standardized measure null, flag the conversion status, and make the reporting limitation explicit. A missing measure is easier to investigate than a confident but false total.

Warning

A null standardized measure with a clear conversion status is usually better than a fabricated conversion that makes reports look complete.

Validation checklist for fact tables with multiple units

Before releasing a fact table that contains multiple units of measure, test the model against the ways people will aggregate it.

  • Can you explain the grain in one sentence?
  • Does every additive measure name include the physical concept and canonical unit?
  • Is source_quantity prevented from being used as a broad default metric?
  • Can every standardized measure be traced to a source unit and conversion rule?
  • Are product-specific pack conversions separated from universal physical conversions?
  • Do conversion rules support effective dates if packaging or definitions change?
  • Are not-applicable conversions represented differently from zero?
  • Can reports reconcile from source quantities to standardized measures for a sample of rows?
  • Do dashboards avoid labels like total quantity when several physical quantities exist?

The best test is a reconciliation example that a business user can inspect row by row. If the row-level math is understandable, the aggregate is much easier to trust.

Common failure modes

The same unit-of-measure problems tend to appear repeatedly in analytics systems.

  • One generic quantity column. The model has source_quantity but no safe standardized measures.
  • Unit dimension without metric rules. Users can see the unit, but the BI tool still sums incompatible values.
  • Product packaging ignored. Cases, packs, pallets, and eaches are treated as universal units instead of product-specific conversions.
  • Conversions overwritten. Historical standardized values change because the model always uses the latest conversion factor.
  • False precision. Estimated conversions are presented with the same authority as exact measurements.
  • Zeros instead of nulls. Not-applicable measures are loaded as zero, making missing conversions look like real absence of activity.
  • Ambiguous dashboard labels. Reports show total quantity without saying whether the total is count, mass, volume, or another measure.

Most of these failures are not tool problems. They are modeling problems. The fix is to define the physical measure, the canonical unit, and the conversion rule before the metric is exposed.

Key takeaways

  • Do not expose a mixed-unit source quantity as a broad summable metric.
  • Keep original quantity and source unit for auditability, but create explicit standardized measures for reporting.
  • Separate measurement families such as count, mass, volume, length, and time.
  • Use product-specific and effective-dated conversion rules when packaging or business definitions vary.
  • Name additive measures with both the physical concept and the reporting unit, such as net_weight_kg or volume_liters.

Next step

Pick one fact table with a generic quantity column. List the distinct source units, group them by measurement family, and define which standardized measures are safe to publish. Then reconcile five sample rows from source quantity to the proposed reporting measures before changing dashboards.

Recommended next reads