Skip to main content

Redesigning an ecommerce reporting stack: six metric dimensions and the LLD that makes them testable

Seamline Editorial · Finance content team · Updated

Adding a dimension does not add a filter. It builds a new table with a new grain, new joins and new numbers. That is why site × SKU and store × site × SKU are two builds, not one view with a WHERE clause. Six metric dimensions need six field dictionaries, each carrying data source, formula, required flag, validation logic and aggregation. The redesign only holds together when a detailed design (LLD) answers How down to interface signatures, table DDL, state machines and error codes, keeps rollout thresholds on the same metric definition as alerts, and gives a canary Runbook a real first step.

Adding a dimension does not add a filter. It builds a new table.

Adding a dimension does not add a filter. It builds a new table. The most common mistake in an ecommerce reporting redesign is to treat site × SKU and store × site × SKU as one dataset with an extra WHERE clause. They are not. The second table has a different grain, different joins, different validity rules, and different numbers.

Grain is the unit of one row. When the grain changes, every additive measure has to be re-derived from the source rows, and every ratio has to be recomputed on a new denominator. A store dimension is not a label you attach after aggregation; it is a key you group by before summing. Skip that step and the two reports will disagree on revenue, and neither will be wrong inside its own frame.

The design material behind this article makes the point awkwardly clear. It defines six separate report dimensions, each as its own sheet with its own field dictionary. None is described as a filtered view of another: they share a base, but each re-aggregates to its own grain. That is a deliberate engineering choice, not an accident of a spreadsheet.

The rules, field logic and state machines below come from one cross-border group’s internal detailed design (LLD) and metric dictionary, anonymized and sanitized to generic patterns: a reporting metrics workbook, a report-center low-level design, and a refund-loss configuration API spec. They are engineering conventions from one company, not accounting standards and not official platform rules. Educational content only, not accounting or tax advice.

A finer report is not a filtered copy of a coarser one. If store × site × SKU were just site × SKU with a filter, you could reconcile them by subtraction. You cannot, because the group-by key changed before any number was summed.

Six metric dimensions, six grains, six jobs

The metrics workbook opens with six sheets. Each answers a different business question, and the grain is set before any metric is named. Read the grain first; it decides what the rest of the fields can even mean.

The first two are the base layers. The SKU dimension keeps one row per order line item, so product cost, quantity and per-line allocated costs stay visible. The order-detail dimension collapses those lines back to one row per order: additive fields become sums, descriptive fields take a single value with max(x), and the SKU detail is packed into a string. That is a lossy transformation done on purpose.

The store and media-buyer dimensions look similar and are not. Store grain derives its department and owner from the store master record. Media-buyer grain derives them from the person who ran the campaign, walks up the org tree, and has to decide what to do when an order has several operators. The workbook answer is explicit: fall back to the store manager. A soft rule like that belongs in a field dictionary, because otherwise two builders pick two values.

The last two are where a redesign usually breaks. Site × SKU groups by market and sub-SKU and adds product-master attributes: operating status, whether the item is a focus product, its category. Store × site × SKU groups by store as well and adds the store-derived owner and org fields. The second is not the first with a store filter, because the store key is joined before aggregation, not painted on afterwards.

Notice what this does to cost allocation. Ad spend, platform fees and refund losses are spread to lines by each row’s share of sales revenue. Change the grain and the denominator changes, so every allocated amount changes with it. That is why the two composite dimensions are separate builds with separate dictionaries, not two views over one fact table.

Six metric dimensions × grain × typical metrics × use case
Metric dimensionGrain (one row =)Typical metricsDecision it supports
SKUOne order line (order + sub-SKU)Item quantity, gross merchandise, product cost, per-line allocated ad / platform / refund costsWhich SKU earns its keep after cost allocation
Order detailOne order (version + order no.); SKU lines packed into a stringOrder revenue, summed quantity, SKU bundle string, order status, payment timeOrder-level tie-out and fulfillment checks
StoreOne store within a report versionOrder count, items per order, average order value, refund rate, per-channel order countsStore P&L and channel mix by store
Media buyerOne operator within a report versionSales revenue, refund loss, ad spend, labor cost, commission, no-output cost rowsPer-operator margin and campaign payback
Site × SKUCountry + sub-SKUOrder count, average order value, SKU operating status, focus-product flag, categoryWhich products work in which market
Store × site × SKUStore + country + sub-SKUThe same metrics plus store-derived owner and org fieldsWhich store should push which SKU in which market
Grain and field behavior from an anonymized internal reporting metrics workbook, redacted to generic dimension names. “Grain” is the documented row key, not an inferred one. No internal table, library, department code, document number or channel rate is reproduced.

A metric dictionary is a contract, not a column list

Every sheet carries the same five-column field dictionary: data source, formula, required flag, validation logic, and aggregation rule. Five columns, not one. A column name alone tells you nothing about where a number comes from or how it should be tested.

Data source separates three cases that dashboards blur together: fields read straight from the order system, fields looked up in master data (the SKU master record, the store master, the currency-rate table), and fields computed in the finance layer. A field that is read, one that is looked up and one that is computed need different tests, because they fail differently.

The required flag and the validation logic are where the workbook is unusually strict. A sub-SKU that cannot be found in master data does not silently disappear; it raises an alert. A month with no configured ratio falls back to the previous month, and if that also misses, the row is skipped with an alert rather than filled with zero. Warn, log, never quietly drop. That single rule prevents most reconciliation disputes.

Aggregation is its own column because it is not derivable from the formula. Additive fields use sum(x), while descriptive fields on a collapsed grain use max(x). Ratios are computed as sum(x) ÷ sum(y), never as the average of row-level ratios; that is why average order value is defined as sales revenue over order count at each grain. A ratio averaged the wrong way is the classic reason two grains disagree.

Field dictionary: the five governance columns behind every metric (worked figures: sample data)
FieldData sourceFormulaRequiredValidation logicAggregation
Sales revenueOrder header + order-line amounts; currency-rate masterItem total + shipping income + shipping-insurance income + tips + subsidies + tax incomeRequiredMissing period exchange rate raises an alertsum(x); shown as a share of total
Item quantityOrder-line detailRead directly from the line quantityRequiredEmpty value raises an alertsum(x)
Average order valueDerived from store-grain aggregationSales revenue ÷ order count. Worked figure: 100.00 ÷ 20 = 5.00 (sample data)DerivedOrder count of 0 renders “--”sum(x) ÷ sum(y), not the mean of row ratios
Estimated refund lossRefund-loss configuration, matched by month + platform + management unit + storeSales revenue × configured estimated ratioConditionalPlatform and store must pass master-data validation; an unmatched month falls back, then skips with an alertsum(x); shown as a share of revenue
Allocated ad spendChannel ad-spend feed + primary-SKU resolutionSum of (spend − voucher) by channel, apportioned to lines by revenue shareConditionalSpend with no primary SKU becomes its own no-output rowsum(x); shown as a share of revenue
Operating profitFinance layer, configurableRevenue − (promotion + logistics + product cost + FX loss + collection + platform + refund + return + labor + fixed costs) + ad subsidyDerivedEvery component must resolve or the configuration raises a promptSum, then a margin ratio
Five governance columns (data source / formula / required flag / validation logic / aggregation) from an anonymized internal report field dictionary, redacted to generic field names. Worked figures are sample data, illustrative only; ratios are internal configuration values, not public quotes. These are engineering conventions, not accounting standards.

HLD states the frame; LLD answers How, down to the error code

The report-center document draws a hard line between a high-level design (HLD) and a low-level design (LLD), and it does it with nine concrete comparison rows, not with a vague “architecture versus design”. The distinction that matters is the question each one answers.

HLD answers What and Why (what the system looks like, how it is split, which technology is chosen), while LLD answers How: how each module is actually built. HLD stops at services and components. LLD goes down to interface signatures and error codes, table DDL with indexes and sharding, cache and message-queue design, state machines, idempotency and concurrency, and exception handling. One is a floor plan; the other is the construction drawing for each room.

Architects, tech leads, project managers and testers read an HLD to learn scope; developers who will code from it, testers who will design cases, and reviewers read an LLD instead. Its completion criterion is unusually concrete: after the design and code-review pre-check, a team should be able to create the tables, write the code and write the tests directly from the document. If a builder still has to ask what a field default is, the LLD is not finished.

Non-functional requirements show the gap best. HLD gives direction and strategy: whether to degrade, how to scale horizontally, which dimensions to monitor. LLD gives landable parameters: connect timeout 1s and read timeout 3s, three retries with exponential backoff, a circuit breaker at a 50% failure rate, and named alert thresholds. A direction cannot be tested; a number can.

HLD vs LLD: the nine comparison dimensions used in the design review
Comparison dimensionHLD (high-level)LLD (detailed)
Core question answeredWhat / Why: system shape, split, technology choiceHow: how each module is implemented
View and grainSystem level, macro: down to service / componentModule level, micro: down to interface, table field, algorithm
Main readersArchitects, tech lead, PM, testers scoping the rangeDevelopers coding, testers designing cases, code reviewer
Content focusOverall architecture, call chains, domain model, use cases, business rules, external dependencies, deployment topologyInterface signatures and error codes, DDL and indexes / sharding, cache / message queue, state machine, idempotency and concurrency, exception handling
Non-functional styleDirection and strategy: whether to degrade, how to scale, which dimensions to watchLandable parameters: 1s / 3s timeouts, 3 retries with backoff, 50% breaker threshold, alert thresholds
Typical diagramsArchitecture diagram, service sequence diagram, ER / concept model, deployment topologyInterface list, table DDL, state-machine diagram, test-case table
Produced whenProject start / early design, before developmentAfter architecture review passes, before coding
Review and done criterionArchitecture review passes: clear boundaries, chosen stack, identified risks → proceed to LLDDesign / code-review pre-check passes: build tables, code and write tests directly from it
RelationshipSet the frame, draw boundaries (upstream)Inherit architecture, fill implementation (downstream, links back to HLD)
Nine comparison dimensions from an anonymized internal report-center low-level design document, redacted to generic roles and parameters. Thresholds shown are generic engineering examples from the design template, not internal channel-rate configuration or public quotes. The contrast is by documented dimension, not a generic “architecture vs design” slogan.

What the LLD must pin down before anyone writes code

A detailed design earns its name by being executable. Interface design lists each method, path, auth, parameter, response and error code. Parameters carry real numbers: page_size defaults to 20 and caps at 100; a response gives real fields, not placeholders; error codes cover the failures that actually happen, such as bad parameter, failed auth and business-rule conflict, rather than four generic ones copied from a template.

Database design is equally literal: each table lists column type, length, default, NOT NULL and index, and each index says which query it serves. If sharding does not apply, the document says so instead of leaving a blank that looks like an oversight. Cache keys carry a version or namespace prefix, a stated TTL and a matching update policy. Anything less and the builder guesses, and guesses are where two environments diverge.

Three mechanisms carry correctness: a state machine, idempotency and concurrency control. The state diagram and the transition table must match line for line, name the terminal state, and say what happens on an illegal transition: a completed state cannot be canceled, and that rule becomes a test case. Every write that can be called twice, from a double click to a redelivered message to an upstream retry, appears in the idempotency table with its key and its lifetime.

The idempotency rule that matters most for finance data: a single source document may take part in only one effective merge. Once a document is merged, a later change does not edit the merged record in place. The system reverses the original and writes a new version, so the audit trail stays intact and the same source document is never counted twice. Combined with a unique index and a message-id deduplication table, this is what stops a retry from doubling revenue.

Concurrency control starts with a judgment, not a lock. The design first asks whether the path is read-heavy or write-contended, then picks: an optimistic version column with UPDATE … WHERE version = old_version for balance changes, a pessimistic row lock or an atomic operation for stock deduction. It also fixes the failure behavior, how many times an optimistic conflict retries and what a lock wait timeout returns, so data stays correct without leaving the user staring at a spinner.

Release discipline ties the design to monitoring. The thresholds watched during a canary rollout must use the same metric definition as the alert thresholds: same numerator, same denominator, same window. Otherwise “looks healthy” during rollout and “alert already firing” can both be true at once. The material insists on this: a 1% canary watching error rate and P99 latency uses the very same >1% error-rate threshold as the business-monitoring table.

Two more rules make the release survivable. Rollback is concrete: who flips which switch, and a target of under five minutes. A Runbook cell is never left empty: step one is to open the business-monitoring dashboard, identify which metric crossed its threshold, and pull the trace_id for that window before touching any code. An alert with a blank Runbook is an alert nobody can act on.

Data migration is a seven-step sequence, and the order is not negotiable. Each step carries an owner and an estimated duration. The script must be idempotent and re-runnable, so a mid-run failure can be retried without creating dirty data, and the consistency check states a numeric tolerance, a difference rate below 0.01%, instead of “roughly consistent”.

Hand the LLD to a developer who did not attend the review. If they can build the tables, code the interface and write a failing test without asking a question, the How is concrete enough.

The refund-loss import draws the hardest transaction boundary

Of everything in the material, the refund-loss configuration API has the strictest rule, and it is the one most often implemented wrong. If any row in an import fails validation, the whole task fails, and no business data from that run may be written. Not the good rows. None of them.

The transaction boundary is therefore explicit. Template-header checks, required-field checks, month-format and ratio-format checks, and master-data lookups all happen before any business write. Platform and store are validated against master data after de-duplicating the file, and the store management-reporting unit is backfilled from the store master. If any row fails, the task is marked failed and a marked-up error file is uploaded; neither the business master table nor the operation-log table is written.

Only when every row passes does the job open a transaction. The upsert on the unique key, month + platform + store plus a soft-delete flag, and the write to the field-change log happen inside that same transaction. A commit failure rolls both back, so no half-configuration survives. That is the concrete meaning of “this run must not land any business data”.

Three details are easy to miss. The accounting month is passed in by the import window as a required task parameter and written to the month field; it is deliberately not a column in the file, which stops a stale template from being loaded into the wrong period. The template has two rows: the first imports both the estimated and actual refund ratios, the second imports only the estimated ratio. And editing cannot change platform, store or month, only the ratios; every field change is recorded in the operation-log table as before-value, after-value, operation type, source task, operator and time.

None of this is accounting guidance. These are engineering rules from an anonymized internal system design document, redacted to a generic pattern, not accounting standards and not official platform rules. What a team can take away is a review checklist: name the grain, write the five-column dictionary, answer How down to the error code, keep rollout and alert thresholds on the same metric definition, and give the Runbook a first step.

Pull any month + platform + store key and ask which config version produced its refund loss. If the answer is not a single, traceable record, the transaction boundary leaked.

FAQ

Is store × site × SKU just site × SKU with a store filter?

No. The store key is joined before aggregation, so the grain, the joins, the denominator for every allocated cost and the store-derived attributes all change. A filter applied after the fact cannot reproduce those numbers. That is why the design builds it as a separate sheet with its own field dictionary.

Why does the metric dictionary need five columns instead of just a formula?

Because a formula does not say where a value comes from, whether it is mandatory, what happens when a lookup misses, or how it aggregates across grains. Those four facts live in the data-source, required-flag, validation and aggregation columns. Tests are written from them, not from the formula alone.

What is the difference between an HLD and an LLD in practice?

An HLD settles boundaries and stack and passes an architecture review. An LLD answers How down to interface signatures, table DDL, state machines and error codes, and its done-criterion is that a team can build tables, code and write tests directly from it. The two are the same design at two heights, and the LLD links back to the HLD.

Are these rules accounting standards I should apply to my books?

No. They come from one cross-border group’s internal detailed design (LLD) and metric dictionary, anonymized and sanitized to generic patterns; they are engineering conventions for one reporting stack, not accounting standards and not official platform rules. For recognition and measurement, use your own standards and advisers.

Trace every metric back to its definition

The demo shows how Seamline detects measurement drift and reconciles reports grain by grain, following a number back to its source field, config version and aggregation rule, so two dashboards that disagree can be pinned to the exact step where they diverged.

Open the demo