Article body
Full article
Three figures come up in the morning meeting, each with a different basis. Channel operations reports a surge in orders last night, finance sees net sales fall after refunds, and the store manager says in-store receipts are unchanged. One order can be placed online, picked up in a store, and partially refunded the next day. Combining those events into a single number makes conversion, performance, and inventory difficult to reconcile. E-commerce analytics should first define which events count toward each metric, which business date they use, and which channel they belong to, then set the refresh cadence for the promotion dashboard.
1. Work backward from business decisions to the data pipeline
Retail teams make decisions at different intervals. On-call campaign staff track payments and inventory by time slot, category teams assess sell-through and gross margin daily, and membership teams generally measure repeat purchases after the full observation window closes. Warehouse, finance, advertising, and marketplace order data can arrive at different times. One dashboard can bring together metrics of different freshness, with each metric showing how far its data extends and whether more campaign data may arrive.
| Business area | Main sources | Suggested grain and use |
|---|---|---|
| Transactions | Marketplace orders, POS, payments, and refunds | Store order lines, payments, and refunds as separate events and aggregate by business key |
| Products and inventory | Product master data, supply and inventory systems, warehouse and store snapshots | Use SKU, warehouse or store, and snapshot time. Distinguish available, reserved, and in-transit stock |
| Membership | CRM, membership records, and authorized customer mappings | Establish cross-channel matching coverage, then calculate by member and observation window |
| Advertising and behavior | Ad reports, platform behavior APIs, and campaign calendars | Use campaign, channel, and time slot. Retain platform attribution windows and cost periods |
HENGSHI SENSE can access supported operational databases and warehouses through data connections. Datasets or data integration can clean, standardize, and aggregate data before models and business metrics feed dashboards. For HTTP JSON results, evaluate an API query dataset. For a lasting integration, check whether a built-in API source is available, whether a custom adapter is needed, or whether an existing ingestion job can load the data first. Implement pagination, authorization, rate limits, late arrivals, and backfills according to each platform’s rules. For documents with mixed field types or arrays, check the expanded grain against representative samples. In particular, verify that expanding a membership record into multiple events leaves transaction amounts intact.
Make ingestion batches traceable
Record the source, shop, API or table, covered business dates, last successful collection time, and active backfills for each channel. If an API rate-limits a job, retain completed pages or batches and record gaps so the dashboard can show which shop is still on its previous batch. If stores can trade offline, POS records can also come in late before closing. Pilot with two physical stores and one online store. Delay one store batch, replay a batch of online records, and change one status mapping to see whether the data team can distinguish the three conditions.
Assign owners to product and membership dimensions. If a platform SKU or warehouse code is unique only within a shop, scope the mapping to the platform and merchant before resolving the external SKU to a common product. Define the minimum access scope for member identifiers. A store may need to retrieve its own member records while the executive view needs totals. Design detail and metric permissions accordingly and apply them to datasets, logical models, and dashboards before using them for conversational analytics.
2. Define order metrics, channel ownership, and business dates together
| Metric | Example definition | Reconciliation check |
|---|---|---|
| Order value | Sum the submitted amount on order placement events | Decide whether historical orders count after cancellation and align that choice with the funnel |
| Paid amount | Sum actual payments on successful payment events | An order may have several payments. Handle pre-authorizations and unpaid orders separately |
| Net sales | Successful payments less completed refunds within the agreed scope | Define taxes, shipping, discounts, and currency. Avoid deducting a return a second time |
| Average spend per purchasing customer | Divide the agreed sales amount by the number of purchasing customers | Average order value is a separate metric. Document how guest purchases count |
Choose channel rules for the use case. Record the online shop as the sales channel, the pickup store as the fulfillment location, and advertising source as a marketing attribution field. Each view can trace the order, while business totals count it once. If source systems reuse order numbers, combine the external order number with its source and shop scope. Define how each refund maps to its original order or line. Retain the original transaction statuses so cancellations, payments, returns, and refunds can be reviewed in order.
Refund dates have two common uses. A promotion review can assign later refunds to the original order batch and label the recalculated version. Daily cash reporting can use the actual refund date. If a customer pays CNY 200 on Friday and receives a CNY 60 partial refund on Saturday, the first report recalculates Friday’s order contribution to CNY 140. The second shows CNY 200 on Friday and CNY −60 on Saturday. Recording the date rule in the model and metric documentation lets campaign dashboards, financial reconciliations, and conversational analytics explain their results.
The SQL below assumes the upstream data is deduplicated by payment or refund event and all amounts are nonnegative CNY values. It calculates net sales by event date. For reporting by original order date, obtain that date from the order before aggregating again.
SELECT business_date, channel_id,
SUM(CASE
WHEN event_type = 'payment_succeeded' THEN amount
WHEN event_type = 'refund_completed' THEN -amount
ELSE 0
END) AS net_sales
FROM trade_events
WHERE business_date >= '2026-11-01'
AND business_date < '2026-12-01'
GROUP BY business_date, channel_id
ORDER BY business_date, channel_id;
In HENGSHI, datasets or logical models can capture the relationship between orders, payments, and refunds, with agreed sales and net sales definitions maintained as business metrics. Before release, have operations, finance, and data staff each check an order with several partial refunds, a buy-online-pick-up-in-store order, and an order spanning two days. When recalculating by channel, product, and total, check which dimensions and detail records the business role can see.
3. Preserve the right grain for products, members, and marketing
Use category, SPU, and SKU to examine sell-through, stockouts, gross margin, and replenishment. If a product is reclassified, distinguish historical views using today’s classification from those that reconstruct the classification at the time of purchase. Use consistently defined snapshots by date and warehouse or store. Monthly inventory can use period-end stock or average daily stock, depending on the metric. For new products, align comparisons by days since launch and check price, promotion, and distribution conditions.
For member repeat purchase rates, use customers eligible for the window as the denominator and deduplicate across regions or channels by the agreed identifiers. Where store cards, online accounts, and distributor customers cannot yet be mapped reliably, report coverage and match rates by channel. RFM analysis can retain last purchase date, frequency, spend, segmentation rule version, and historical batches. Customer lifetime value needs an observation window, a revenue or profit scope, and a refund policy. Label predictions separately.
Compare promotion conversion rates at the same campaign stage and specify whether they use visitors, sessions, or qualified traffic. Define spend, discounts, attribution, and refunds for campaign ROI and identify the estimate’s cutoff. Marketing touchpoints and sales channels can be analyzed separately. A touchpoint may receive all marketing credit while the sale remains in its sales channel, with business totals aggregated by unique order or event.
Connect product and marketing metrics in one campaign review
Use the first two hours after sales open as the comparison window. A product has two variants, and the store system shows 50 units available with 12 reserved. If available stock has yet to deduct reservations, only 38 units can be allocated. For online orders picked up in store, also check stock at the fulfilling location. Pre-promotion demand forecasts can appear separately with the relevant locations, products, and forecast time. Staff can use the forecast to identify items worth watching and make decisions based on actual stock and replenishment times.
For the review, align campaign impressions, qualifying visits, successful payments, completed refunds, and marketing costs to the same observation window. If finance confirms costs remain unposted, display posted costs and the estimated scope. Keep the ROI formula and cost definition in the metric documentation. Comparing two campaigns with clearly defined conditions makes the analysis easier to verify than a single monthly sales contribution figure.
4. Show how current the promotion dashboard is
Give payments, refunds, and inventory their own readiness conditions. The dashboard can show the latest payment and refund timestamps and whether net sales are settled. If payments are current through 10:30 and refunds through 10:00, show the payment trend and mark net sales as incomplete or state the cutoff. Recalculate affected partitions when backfills arrive and retain the refresh record. HENGSHI data integration and bulk synchronization can support extraction and scheduled runs. End-to-end freshness also depends on source updates, scheduling, and query load.
Pre-aggregate same-day high-frequency results by time slot, channel, and category. Amounts and unit counts can generally be rolled up. Recompute distinct member counts for the relevant population, aggregate conversion numerators and denominators separately, and apply snapshot rules to end-of-day inventory. HENGSHI aggregate datasets can define dimensions and measures and use the acceleration engine as needed. Test historical refund backfills, campaign peaks, and ad hoc drill-downs to find when aggregate and detail results agree and how much source load those queries create.
Define three delays that can be verified independently
At ingestion, record the source business timestamp and the time the record was loaded. At the refresh stage, record when model or aggregate results became queryable. At consumption, record the dashboard refresh or alert arrival. Measure their differences against the business calendar and time zone to distinguish ingestion, processing, and consumption delays. If a channel has loaded but is absent from aggregate results, check input completeness and model refresh. If the problem involves chart caching or user access, on-call staff can investigate the relevant dashboard without rerunning every job.
Before release, simulate opening the dashboard, switching channels, and drilling into an order at the expected promotion peak. Serve common summary metrics from an appropriate aggregate and enable raw transactions, support details, and diagnostic paths on demand. During load testing, observe source capacity, failure behavior, and whether staff can distinguish stale data from an empty result. Set refresh, notification, and response-time objectives from the project’s business deadlines.
5. Move from alerts and interpretation to human action
HENGSHI SENSE can configure chart metric thresholds, check times, and email or webhook notifications in supported application views. Start with available stock days, inventory risk, or payment anomalies and test recipients, cadence, and delivery. After receiving an alert, users can return to the dashboard to check the data date, coverage, and affected stores and SKUs. Replenishment, transfers, and pauses in advertising are confirmed and recorded by the relevant owners and business systems.

HENGSHI documentation screenshot. Metric alerts in application settings.
Authorized business users can ask Data Agent, for example, “By payment date, how much did East China stores actually receive last night, and through what time is the data current?” Dashboards or charts with intelligent interpretation can use an analysis sequence to check history, incoming data, exception distribution, and items that need review. For replenishment or campaign demand forecasts, bring in validated projections and retain the version, error range, and manual adjustments.
| Exercise | Expected observation |
|---|---|
| A marketplace refund is late or backfilled | The dashboard visibly indicates freshness and recalculates using the agreed date rule |
| A pickup order appears in two systems | Verify the sales channel and fulfillment location and count the amount once |
| Drill down to store and SKU | Business users see their authorized detail, and differences from totals can be explained |
| The same risk triggers repeatedly | Notify at an appropriate cadence and distinguish repeated reminders from new events |
| Dashboard traffic peaks during the promotion | Check aggregate and detail response times, refresh state, and source load |
To decide whether the dashboard is ready, ask three questions. Can an order be traced from the dashboard to its source events? Are differences in business-date rules visible? Can an alert recipient quickly find evidence and confirm an action? Test all three with real samples before expanding to more campaigns and teams.
About HENGSHI
Founded in 2016, HENGSHI develops Agentic BI for the Data+AI era. Its enterprise analytics platform HENGSHI SENSE works with the HENGSHI Digital Employee, the HENGSHI CLI execution engine, and the privately deployed HENGSHI BOX to offer an integrated platform. With a decade of BI experience and its Powered by Hengshi partner strategy, HENGSHI works with software providers across industries to deliver private AI analytics for enterprise operations and decision-making in manufacturing, finance, retail, and government.