offdataai
Retail & E-commerce · data model template

Retail & E-commerce Analytics data model

Kimball dimensional warehouse for omnichannel retail: transaction-grain sales, order-header funnel, periodic inventory snapshots, returns, and web events — sharing conformed customer, product, store, date, and promotion dimensions (SCD2 where history matters).

End-to-end retail and e-commerce analytics covering sales, orders, inventory, returns, and clickstream — built as a Kimball star schema with conformed dimensions so every business process is measured by the same customer, product, store, and date. It is a Kimball dimensional model: fact tables at a declared grain surrounded by conformed dimensions, ready for BI tools and a semantic layer.

KimballRetail & E-commercePCI-DSSGDPRCCPA
15
tables
163
columns
28
relationships
11
PII columns

Opening the template creates a project with the ERD, platform-native DDL, a dbt project and documentation already generated (recommended platform: Snowflake). Edit it in plain English or on the canvas, then ship it to any supported warehouse.

Subject areas

salesinventorydigitalconformed_dimensions

Design decisions

  • Transaction-grain fct_sales

    Storing one row per order line is the lowest useful grain and lets every measure roll up to product, customer, store, or day without loss.

  • SCD2 on customer, product, employee

    Loyalty tier, address, price, and role change over time; type-2 history preserves the value as-of each transaction.

  • Separate periodic snapshot for inventory

    Inventory levels are semi-additive and best modeled as a daily snapshot rather than transactions.

Tables in the Retail & E-commerce Analytics model

Every table with its grain, columns, types and keys. PK marks a primary key, BK a business key and PII a column classified as personal data, which gets a masking strategy by default.

Fact tables (5)

fct_sales

Grain: one row per order line item

Transaction-grain sales fact — the heart of the bus matrix.

ColumnTypeKeys
sales_keybigintPK
date_keybigint
customer_keybigint
product_keybigint
store_keybigint
channel_keybigint
promotion_keybigint
employee_keybigint
payment_method_keybigint
shipping_method_keybigint
order_numbervarchar
order_line_numbersmallint
quantityinteger
unit_pricedecimal
discount_amountdecimal
tax_amountdecimal
gross_amountdecimal
net_amountdecimal
cost_amountdecimal
margin_amountdecimal

fct_orders

Grain: one row per order header

Order-header fact for funnel + fulfillment analysis.

ColumnTypeKeys
order_keybigintPK
date_keybigint
customer_keybigint
store_keybigint
channel_keybigint
payment_method_keybigint
shipping_method_keybigint
order_numbervarchar
order_statusvarchar
item_countinteger
subtotaldecimal
discount_totaldecimal
shipping_costdecimal
tax_totaldecimal
order_totaldecimal

fct_inventory_snapshot

Grain: one row per product per store per day (periodic snapshot)

Periodic snapshot fact — semi-additive (snapshot quantities).

ColumnTypeKeys
date_keybigint
product_keybigint
store_keybigint
quantity_on_handinteger
quantity_on_orderinteger
quantity_committedinteger
reorder_pointinteger
units_soldinteger
stockout_flagboolean
inventory_valuedecimal

fct_returns

Grain: one row per returned line item

ColumnTypeKeys
return_keybigintPK
date_keybigint
customer_keybigint
product_keybigint
store_keybigint
order_numbervarchar
reason_codevarchar
quantity_returnedinteger
refund_amountdecimal
restock_flagboolean

fct_web_events

Grain: one row per web/app interaction event

Event-grain clickstream fact.

ColumnTypeKeys
event_keybigintPK
date_keybigint
customer_keybigint
product_keybigint
channel_keybigint
session_idvarchar
event_typevarchar
event_timestamptimestamp
page_urlvarchar
device_typevarchar
referrervarchar

Dimension tables (10)

dim_date

Grain: one row per calendar day

Conformed date dimension shared by every fact.

ColumnTypeKeys
date_keybigintPK
full_datedateBK
day_of_weeksmallint
day_namevarchar
day_of_monthsmallint
day_of_yearsmallint
week_of_yearsmallint
month_numbersmallint
month_namevarchar
quartersmallint
yearsmallint
fiscal_periodvarchar
is_weekendboolean
is_holidayboolean
holiday_namevarchar

dim_customer

Grain: one row per customer per SCD2 version

Type-2 SCD: tracks loyalty tier and address history.

SCD type 2

ColumnTypeKeys
customer_keybigintPK
customer_idvarcharBK
first_namevarcharPII
last_namevarcharPII
emailvarcharPII
phonevarcharPII
date_of_birthdatePII
gendervarchar
loyalty_tiervarchar
loyalty_pointsinteger
address_line1varcharPII
cityvarchar
state_provincevarchar
postal_codevarcharPII
countryvarchar
customer_segmentvarchar
acquisition_channelvarchar
signup_datedate
is_activeboolean

dim_product

Grain: one row per product per SCD2 version

SCD type 2

ColumnTypeKeys
product_keybigintPK
product_idvarcharBK
skuvarchar
product_namevarchar
brandvarchar
categoryvarchar
subcategoryvarchar
departmentvarchar
supplier_keybigint
unit_costdecimal
list_pricedecimal
colorvarchar
sizevarchar
weight_gramsinteger
is_activeboolean

dim_store

Grain: one row per store / channel location

ColumnTypeKeys
store_keybigintPK
store_idvarcharBK
store_namevarchar
store_typevarchar
address_line1varchar
cityvarchar
state_provincevarchar
regionvarchar
countryvarchar
manager_namevarcharPII
open_datedate
square_footageinteger

dim_supplier

Grain: one row per supplier

ColumnTypeKeys
supplier_keybigintPK
supplier_idvarcharBK
supplier_namevarchar
contact_emailvarcharPII
countryvarchar
lead_time_dayssmallint
ratingdecimal

dim_employee

Grain: one row per employee per SCD2 version

SCD type 2

ColumnTypeKeys
employee_keybigintPK
employee_idvarcharBK
full_namevarcharPII
emailvarcharPII
rolevarchar
departmentvarchar
store_keybigint
hire_datedate
is_activeboolean

dim_promotion

Grain: one row per promotion

ColumnTypeKeys
promotion_keybigintPK
promotion_idvarcharBK
promotion_namevarchar
promotion_typevarchar
discount_pctdecimal
start_datedate
end_datedate
channelvarchar

dim_payment_method

Grain: one row per payment method

ColumnTypeKeys
payment_method_keybigintPK
method_codevarcharBK
method_namevarchar
providervarchar

dim_shipping_method

Grain: one row per shipping method

ColumnTypeKeys
shipping_method_keybigintPK
method_codevarcharBK
carriervarchar
service_levelvarchar
estimated_dayssmallint

dim_channel

Grain: one row per sales channel

ColumnTypeKeys
channel_keybigintPK
channel_codevarcharBK
channel_namevarchar

Relationships

Each relationship is a foreign key on the first table referencing the second.

  • fct_sales.date_key → dim_date (many-to-one)
  • fct_sales.customer_key → dim_customer (many-to-one)
  • fct_sales.product_key → dim_product (many-to-one)
  • fct_sales.store_key → dim_store (many-to-one)
  • fct_sales.channel_key → dim_channel (many-to-one)
  • fct_sales.promotion_key → dim_promotion (many-to-one)
  • fct_sales.employee_key → dim_employee (many-to-one)
  • fct_sales.payment_method_key → dim_payment_method (many-to-one)
  • fct_sales.shipping_method_key → dim_shipping_method (many-to-one)
  • fct_orders.date_key → dim_date (many-to-one)
  • fct_orders.customer_key → dim_customer (many-to-one)
  • fct_orders.store_key → dim_store (many-to-one)
  • fct_orders.channel_key → dim_channel (many-to-one)
  • fct_orders.payment_method_key → dim_payment_method (many-to-one)
  • fct_orders.shipping_method_key → dim_shipping_method (many-to-one)
  • fct_inventory_snapshot.date_key → dim_date (many-to-one)
  • fct_inventory_snapshot.product_key → dim_product (many-to-one)
  • fct_inventory_snapshot.store_key → dim_store (many-to-one)
  • fct_returns.date_key → dim_date (many-to-one)
  • fct_returns.customer_key → dim_customer (many-to-one)
  • fct_returns.product_key → dim_product (many-to-one)
  • fct_returns.store_key → dim_store (many-to-one)
  • fct_web_events.date_key → dim_date (many-to-one)
  • fct_web_events.customer_key → dim_customer (many-to-one)
  • fct_web_events.product_key → dim_product (many-to-one)
  • fct_web_events.channel_key → dim_channel (many-to-one)
  • dim_product.supplier_key → dim_supplier (many-to-one)
  • dim_employee.store_key → dim_store (many-to-one)

Related templates

All templates →
Start for $1

From requirements to AI-ready context, in one platform.

Describe your business in a conversation, start from a template or connect your own database. Your first model is ready in minutes.

Get startedBook a demo

Plans from $1/month · cancel any time