Skip to main content
Murillo Costa
Phase 04 · Data architecture

Enterprise Data& Dimensional Modelling

Translate GreenBox's business processes and requirements into a durable analytical model: explicit fact grains, conformed dimensions, traceable relationships, and reusable structures for trusted metrics.

  • Dimensional Modelling
  • Fact Grain
  • Conformed Dimensions
  • Bus Matrix
  • SCD Strategy
  • Snowflake + dbt

Fictional portfolio case study · Proposed design, not a deployed production model.

1. Modelling approach

The model starts from business questions and process grain, not from a direct copy of source-system tables. Each fact represents a clearly defined business event or state, with dimensions providing consistent analytical context.

Principle 01

Declare the grain first

Write one precise sentence describing what one row represents before choosing measures, keys, or dimensions.

Principle 02

Keep different processes separate

Orders, shipment lines, invoices, returns, inventory movements, and snapshots have different grains and should not be collapsed into one fact.

Principle 03

Conform shared dimensions

Customer, Product, Location, and Date should have consistent meaning across eligible business processes.

Principle 04

Preserve atomic detail

Retain appropriate transactional detail for traceability and flexible analysis; use aggregates when performance needs justify them.

Principle 05

Make relationships explicit

Model one-to-many and many-to-many relationships carefully, especially split shipments, multiple invoices, and returns.

Principle 06

Separate facts from metrics

Facts store business events or states. Approved metric definitions belong in a governed semantic layer rather than being reinvented per report.

Core rule: A join is not safe just because two tables share an order ID. Validate the grain and cardinality before combining measures, or duplicated rows can inflate revenue, quantity, cost, and delivery counts.

2. Initial Enterprise Bus Matrix

The matrix shows which shared dimensions are expected to support each business process. This is a proposed logical design and must be validated against source data and business definitions.

Business process / fact candidateDateCustomerProductLocationSupplierOrderCampaignAccount
Sales order lineYesYesYesYesNoYesNoNo
Return lineYesYesYesYesNoYesNoNo
Purchase order lineYesNoYesYesYesNoNoNo
Supplier delivery lineYesNoYesYesYesNoNoNo
Inventory movementYesNoYesYesNoNoNoConditional
Inventory snapshotYesNoYesYesNoNoNoConditional
Shipment lineYesYesYesYesNoYesNoNo
Invoice lineYesYesYesNoNoYesNoConditional
Payment applicationYesYesNoNoNoNoNoYes
Lead / campaign performanceYesConditionalNoNoNoNoYesNo
Customer caseYesYesConditionalNoNoConditionalNoNo

● Candidate dimension relationship. *Conditional or role-specific relationship requiring validation. “Order” may be a degenerate dimension or a related order identifier, depending on the model. Date is role-playing where a process has multiple meaningful dates.

3. Fact table catalogue

Each fact table has a declared grain and a business purpose. Measure definitions and exact source mappings remain subject to validation and business approval.

Fact candidateProposed grain — one row per…Purpose / example measuresKey relationshipsDesign notes
fct_sales_order_lineProduct line on a customer sales orderOrdered quantity, unit price, line discount; commercial value only after definition approvalCustomer, Product, Order, order dates, selling locationKeep order-line grain; don't add shipment-level attributes directly without handling cardinality.
fct_return_lineProduct line on a return transactionReturned quantity and approved return valueCustomer, Product, original order line, return date, locationSeparate from sales. Netting rules belong in approved metrics.
fct_purchase_order_lineProduct line on a purchase orderOrdered quantity, unit cost, requested date, committed dateProduct, Supplier, Location, purchase order, datesCapture original commitments and changes if source supports them.
fct_supplier_delivery_lineProduct line received against a supplier deliveryReceived quantity, receipt timestamp, delivery varianceProduct, Supplier, Location, purchase order, receipt dateA PO line may have multiple receipts; preserve that relationship.
fct_inventory_movementOne stock movement for a product and locationSigned quantity, movement type, movement timestampProduct, Location, Date; optional source transactionTransactional event fact. Do not treat as a snapshot.
fct_inventory_snapshotProduct × location × snapshot timestamp or dateOn-hand quantity and other approved stock balances / valuationProduct, Location, Snapshot DatePeriodic snapshot; valuation and inventory status rules require Finance/Supply Chain approval.
fct_order_fulfilmentOrder-line fulfilment allocation or lifecycle instanceAllocated, picked, packed, fulfilled quantities; milestone timestampsOrder line, Product, Location, Customer, relevant datesAccumulating snapshot candidate. Decide how repeated allocations and reopened fulfilments are represented.
fct_shipment_lineOrder-line allocation within a shipmentShipped quantity, dispatch time, delivery time, delivery statusOrder line, Shipment, Product, Customer, ship-from location, datesSupports split shipments. Delivery commitment and OTIF rules need approval.
fct_invoice_lineProduct or charge line on an invoiceInvoiced quantity, line amount, approved tax/discount attributesCustomer, Product or charge, Invoice, Order, datesInvoice grain differs from order and accounting-entry grain.
fct_payment_applicationPayment amount applied to an invoice or receivableApplied amount and application dateCustomer, Invoice, Account, DateOne payment may apply to multiple invoices; unapplied cash needs separate treatment.
fct_lead / fct_opportunityOne lead record / one opportunity record or lifecycle instanceLead status, stage changes, conversion milestonesCampaign, Customer/Contact, owner, datesDecide event fact versus accumulating snapshot based on questions and source history.
fct_customer_caseOne customer service caseCase count, resolution duration, first-contact resolution indicator when definedCustomer, dates, optional Product/Order referencesReopened cases, duplicate cases, and business-hours calculations need explicit rules.
fct_campaign_performanceProposed campaign × channel × reporting period (to validate)Spend, impressions, clicks, leads; attributed revenue only under approved rulesCampaign, Date, channel; optional CustomerAggregate fact candidate. Do not join it to order lines as if the grains were identical.

4. Conformed dimensions and key strategy

Dimensions provide stable, shared business context across facts. The final attributes and keys will be determined after source profiling and business identity rules are documented.

dim_customer

Enterprise customer identity and reporting attributes used across sales, shipments, invoices, payments, and cases.

  • Warehouse surrogate key
  • Enterprise business identifier
  • Source-system identifiers and source mapping
  • Customer status, segment, hierarchy, region (subject to validation)

dim_product

Shared product identity for sales, procurement, inventory, and fulfilment.

  • Warehouse surrogate key and enterprise product ID
  • Source product codes and cross-reference mapping
  • Product category, packaging type, status (to validate)
  • Product mapping/standardisation before conformed use

dim_location

Consistent representation of warehouses, branches, and other operational locations.

  • Location surrogate key and source identifiers
  • Location type and operating region
  • Effective-dated attributes if location history matters

dim_date

Reusable calendar dimension with role-playing relationships for different business dates.

  • Order date, ship date, delivery date, invoice date, payment date
  • Fiscal calendar and business-day attributes after confirmation

dim_supplier / dim_campaign

Conformed context for supplier performance and campaign analysis.

  • Supplier identity across procurement and receipts
  • Campaign identifiers and hierarchy
  • Attribution details are not assumed to be dimension attributes

Degenerate and role-specific dimensions

Transaction identifiers such as Order Number or Invoice Number may remain directly in facts where useful, without a separate dimension table.

  • Use role-playing dates for multiple date contexts
  • Use bridge tables only when a real many-to-many relationship needs representation

Key strategy: use warehouse surrogate keys for dimensional joins, preserve source-system identifiers for traceability, and maintain enterprise business IDs where entity resolution is possible. Never assume source IDs are globally unique across ERP instances or acquired systems.

Slowly Changing Dimensions (SCD) — initial strategy

Type 1 may be suitable for correcting attributes where history is not required. Type 2 may be appropriate where historical analysis must preserve the attribute value effective at the time of a transaction, such as a customer segment or product classification. The correct policy is attribute-specific and must be agreed with the business; do not apply Type 2 to every column by default.

5. Order-to-fulfilment lifecycle

The model deliberately separates the major stages because an order can have multiple fulfilment allocations, shipments, deliveries, invoices, and payments.

  1. 1 · Sales order

    Order header and order lines record what the customer requested.

  2. 2 · Allocation & fulfilment

    Allocation, picking, and packing track how demand is fulfilled.

  3. 3 · Shipment & delivery

    Shipment lines capture dispatched quantities and delivery milestones.

  4. 4 · Invoice & payment

    Invoice lines and payment applications record downstream financial events.

Example: one order line for 100 units may be fulfilled in two shipments of 60 and 40 units. A model that joins the order line to both shipments and then sums the original order value can count that value twice. Keep each fact at its declared grain and relate them through keys or a controlled bridge/relationship design.

Candidate relationship path

Sales order line → fulfilment allocation → shipment line → invoice line → payment application. This is a conceptual path, not a guarantee of one-to-one joins. Real source relationships and exceptions must be profiled.

Returns and adjustments

Return lines should reference the original order line where the source supports it. Credits and accounting adjustments may follow separate processes and should not be inferred from the return alone.

6. Quality, testing, and validation

Tests should prove that the model is structurally sound and that its business meaning matches approved rules. Passing technical tests alone does not establish business correctness.

Structural tests

  • Primary key uniqueness at declared grain
  • Not-null required keys
  • Referential integrity to dimensions
  • Valid date and status domains

Relationship tests

  • Profile one-to-many and many-to-many cardinality
  • Identify orphaned source keys
  • Validate order-line to shipment mappings
  • Detect duplicate source records

Business reconciliation

  • Reconcile source counts and amounts within agreed scope
  • Validate returns and credit treatment
  • Check inventory snapshot totals and status rules
  • Obtain owner approval for KPI calculations

Proposed model acceptance criteria

  • Every fact model has a written grain statement and documented business purpose.
  • Measures are additive, semi-additive, or non-additive as appropriate, with limitations documented.
  • Dimension keys and source identifiers are traceable and tested.
  • Potential fan-out joins are documented and prevented from inflating measures.
  • Source-to-target mappings and known data-quality limitations are recorded.
  • Business-owned definitions are not marked approved until the relevant owner confirms them.

7. Decisions and assumptions to resolve

The model is intentionally a documented design, not a claim that all business rules or source relationships have already been verified.

DecisionWhy it mattersRequired inputStatus
Revenue and Gross Margin definitionsDetermines approved measures and reconciliation logicFinanceApproval required
OTIF grain and delivery commitmentDefines eligible population, date, and completeness rulesSupply Chain + Sales + Finance as neededApproval required
Enterprise Customer identityPrevents duplicate or inconsistent customer reporting across systemsSales, Finance, CRM / data ownersTo validate
Product mapping across ERPs and ShopifyNeeded for conformed product analysisProduct / Procurement / source ownersTo validate
Order-to-shipment source relationshipsDetermines safe joins and split shipment handlingSales and Supply Chain source profilingTo validate
Inventory valuation and stock statusesImpacts inventory value and available stock measuresFinance + Supply ChainApproval required
SCD policy by attributeDetermines how historical dimension changes are representedBusiness owners and data governanceTo validate
Campaign attribution methodologyPrevents double-counted or misleading campaign revenueMarketing + FinanceApproval required

8. Deliverables and transition

Step 4 establishes the logical modelling blueprint. The next phase designs the Snowflake platform structures and operational controls that will host and run these models.

Step 4 outputs

Modelling artefacts

  • Enterprise Bus Matrix draft
  • Fact catalogue with grain statements
  • Conformed dimension strategy
  • Order-to-fulfilment relationship design
  • Key, SCD, quality, and validation principles
  • Open decisions and assumptions register

Next · Step 5

Snowflake Platform Architecture

Define database and schema boundaries, RAW/STAGING/CORE/MARTS responsibilities, roles and grants, warehouse sizing and workload isolation, environment strategy, deployment, cost monitoring, and operational controls.

← Return to the project roadmapReview Step 3 ↗Continue to Step 5 →

Step 4 status: documented design. Fact grains and candidate dimensions are proposed; source mappings, KPI formulas, and business approval remain to be validated before implementation.

← Return to GreenBox project roadmap