Notes
Data, Measurement, and Marketing Variables
Units of Analysis, Metrics, Validity, and the Data Dictionary
Dr. Jose Mendoza, Academic Director and Clinical Associate Professor
Version 1.0 · July 2026
Except where otherwise noted, this chapter is licensed under CC BY 4.0.
Chapter Information
Abstract
This chapter examines the measurement foundations of marketing analytics. It presents measurement as the disciplined translation of marketing concepts into recorded data; distinguishes the grain of a table from the unit of analysis of a claim; and classifies variables by level of measurement and by stored data type. The chapter separates four analytic roles — metric, key performance indicator, dimension, and feature — and shows why a ratio metric requires a stated numerator, denominator, window, and filters. Sections on validity, reliability, proxies, and data quality preview the preparation work of Chapter 4. The chapter’s central instrument is the data dictionary, which records column and metric definitions so that a dataset can be used consistently by a team. A Google Colab lab reconstructs a StyleCraft dispute in which three teams report three different repeat purchase rates, and resolves it with a written definition.
Keywords
measurement; operational definition; unit of analysis; grain; levels of measurement; metrics; key performance indicators; validity and reliability; data quality; data dictionary
Version and Date
Version 1.0 · July 2026 · Language: English (United States)
Suggested Citation
Mendoza, J. (2026). Data, measurement, and marketing variables. In Applied business analytics for marketing decision-making: Business analytics and data visualization (Chapter 3, Version 1.0) [Open educational resource]. CC BY 4.0.
License and Rights
Copyright © 2026 Jose Mendoza. Except where otherwise noted, this work is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0). You may share and adapt this material for any purpose, provided appropriate credit is given. Third-party trademarks, screenshots, figures, and other materials remain subject to their respective rights and licenses.
Google Colab is a product of Google LLC. “Python” and the Python logos are trademarks or registered trademarks of the Python Software Foundation. pandas is a sponsored project of NumFOCUS, a 501(c)(3) nonprofit charity in the United States. Tableau is a trademark of Salesforce, Inc. Product names are used for identification only and do not imply endorsement. StyleCraft Collective is a fictional company created for instruction.
Companion Repository
Datasets, notebooks, and figure sources for this chapter: https://github.com/jrmst102/businessanalytics
Chapter Learning Objectives
By the end of this chapter, students should be able to:
- Explain how marketing concepts become recorded data through operational definitions, and why every dataset embeds measurement decisions.
- Distinguish the grain of a table from the unit of analysis of a claim, identify fact and dimension tables, and explain how aggregation changes the claim an analysis can support.
- Classify marketing variables by level of measurement (nominal, ordinal, interval, ratio) and by stored data type, and explain why the classification governs which summaries, charts, and models are appropriate.
- Define and distinguish metrics, key performance indicators (KPIs), dimensions, and features, and recognize one business concept appearing in several analytic roles.
- Specify a ratio metric completely, by naming its numerator, denominator, time window, and filters.
- Assess the validity and reliability of marketing measures, including proxy measures, and identify common data quality problems.
- Build a data dictionary that documents columns, metric definitions, owners, and decision uses, and use it to resolve measurement disagreements.
- Use a basic Google Colab workflow to inspect variable types, verify them against intended measurement levels, and demonstrate how one metric name can produce several defensible numbers.
Chapter 2 introduced the analytic specification, the one-page document that connects a marketing decision to analytical questions, data, methods, and a verification plan. Completing a specification, however, forces the analyst to make commitments that Chapter 2 deferred: naming a unit of analysis, choosing variables, and defining metrics precisely enough that two people computing them would get the same number. This chapter examines those commitments. Its purpose is to show that every number in an analysis is the product of measurement decisions, and to introduce the working document that makes those decisions inspectable and shared: the data dictionary.
Concept
What This Chapter Is Really About
Chapter 2 argued that the most important work in an analytics project happens before the dataset is opened. This chapter makes a companion claim: the most dangerous work in an analytics project is the work nobody notices doing. Every time an analyst accepts a column as given, treats a metric name as self-explanatory, or lets a spreadsheet decide what “active customer” means, a measurement decision has been made silently. Silent decisions cannot be verified, defended, or shared. The discipline developed in this chapter is to make measurement decisions explicit — in the unit of analysis, in the variable types, in the metric definitions, and ultimately in a data dictionary the whole team can read. In other words, a number is a claim, and this chapter is about learning to state the claim precisely.
3.1 Marketing Decision Context: One Metric, Three Numbers
Chapter 2 ended with the analytics team’s memo to the StyleCraft CMO and CFO: pause the two most discretionary store openings, continue the committed sites, and decide again next quarter with two named analyses in hand. The memo was well received. It also had an unintended consequence.
Because the memo made repeat purchase rate the headline evidence, everyone at StyleCraft now wants to talk about repeat purchase rate. At the follow-up meeting, three numbers appear on three slides. The vice president of retail opens with a reassuring figure: “Sixty percent of our customers come back. Our customer base is loyal.” The CRM manager follows with the figure from the memo: “Repeat purchase rate is 43 percent, and it has been drifting down.” Finally, the finance analyst shares a dashboard from the business intelligence tool: “Store repeat rate is 20 percent. The retail economics do not work.”
The CFO looks at the three slides and asks the question the whole meeting has been building toward: “Which of these numbers is wrong?”
The uncomfortable answer, which this chapter develops, is that none of them is wrong, and that this is precisely the problem. The retail figure counts a customer as a repeat buyer if they ever purchased twice, computed among customers with at least one completed order in the available company history. The CRM figure counts repeat purchases within the trailing twelve months, among customers who were active in that window. The finance dashboard counts repeat purchases in physical stores only, within the same window, among customers who shopped in a store. Same company, same underlying transactions, three defensible computations — and three numbers ranging from 20 percent to 60 percent, each circulating under the same name.
No one at the meeting can adjudicate among the three slides, because no one ever wrote down what “repeat purchase rate” means at StyleCraft. There is no shared definition of the numerator, the denominator, the time window, or the filters. There is, in other words, no data dictionary.
The meeting does not end with a shrug, and this is what makes the episode a decision rather than an anecdote. The CFO closes it by attaching the disagreement to a name and a date: before the quarterly expansion review on October 15, she and the CMO will approve one official definition of repeat purchase rate, and the analytics team is asked to bring the alternatives, a recommendation, and the reasoning behind it.
Three consequences follow from whichever definition is approved. First, it becomes the baseline on the expansion dashboard, the figure against which every subsequent quarter is read. Second, it enters the same-age store comparison that Chapter 2 promised, where it will carry real weight in the decision to continue or cancel the remaining openings. Third — and this is the consequence most easily overlooked — the CRM manager has already been told that her team’s performance target for next year will be expressed in it.
That third consequence converts a documentation task into a managerial one. Chapter 2 observed that once a measure becomes a target, behavior reorganizes around the measure and the measure degrades as evidence (Section 2.12). StyleCraft is about to elevate a phrase that currently denotes three different quantities, and to attach a dashboard, a strategic review, and a team target to whichever one wins. The stake, then, is not accuracy. All three numbers are accurate. The stake is that an organization is about to build three commitments on a word it has never defined.
This situation is representative of professional practice. It is widely observed that measurement disagreements inside organizations are rarely arithmetic disputes; they are definitional disputes wearing arithmetic clothing. The analyst’s task in such moments is not to recompute but to make the definitions visible, and then to help the organization choose the definition that serves the decision. This chapter builds the vocabulary and the tools for doing exactly that, and the chapter’s lab (Section 3.10) reconstructs the three numbers above in miniature so that the mechanism can be verified line by line.
Concept
A Number Is a Claim
Every reported figure is shorthand for a longer sentence of the form: “Applying this definition, to this unit of analysis, over this time window, with these filters, using this data source, yields this value.” When the longer sentence is left unstated, different people silently complete it in different ways, and the same metric name comes to denote different quantities. The discipline of this chapter is to write the longer sentence down.
Source: Course concept developed for this guide, informed by Stevens (1946) and Churchill (1979).
3.1.1 Opening Case Questions
- Restate each of the three repeat purchase figures as a complete sentence: what is being counted, over what population, in what window, with what filters?
- Which of the three definitions is most relevant to the store-expansion decision from Chapter 2, and why?
- The retail figure (60 percent) is the largest and the most reassuring. Is it wrong? Is it misleading? Explain the difference.
- The approved definition will serve three purposes: a dashboard baseline, a strategic review, and a team performance target. Should one definition serve all three? What would you lose by using different definitions for different purposes?
- If StyleCraft adopts one official definition, what legitimate needs of the other two teams might be lost? How could those needs still be served?
- Who in the organization should own the definition of a metric like repeat purchase rate: analytics, the team that uses it most, or the decision-maker it informs?
3.2 From Concept to Column: What Measurement Is
The previous section presented a dispute created by unexamined measurement. This section steps back and asks what measurement is, because the rest of the chapter depends on the answer.
Marketing reasons in concepts: loyalty, engagement, awareness, satisfaction, price sensitivity, brand equity. Datasets contain none of these. Datasets contain columns: loyalty_tier, email_opt_in, order_date, discount_pct. Between the concept and the column lies measurement — the set of rules by which observations of the world are assigned numbers, labels, or categories. In a classic formulation, measurement is “the assignment of numerals to objects or events according to rules” (Stevens, 1946, p. 677). The definition is deliberately modest. It reminds the analyst that the numbers were not found in the world; they were produced by rules, and the rules can be good or bad, shared or private, documented or silent.
The rule that connects a concept to a recorded value is called an operational definition. “Repeat customer” is a concept; “a customer with two or more completed orders in the trailing twelve months” is an operational definition. The three slides in Section 3.1 represent three different operational definitions of the same concept, which is why they produce three different numbers without anyone making an arithmetic error. Marketing research has long emphasized that constructs must be carefully translated into measures before they can be analyzed, and that poor translation, rather than poor statistics, is the more common source of misleading findings (Churchill, 1979).
Moreover, most marketing datasets are not designed for analysis at all. They are the by-products of operational systems: the e-commerce platform records orders because it must fulfill them; the email platform records opens because it must render messages; the point-of-sale system records line items because it must charge cards. Each system measures what it needs for its own operation, using its own definitions, identifiers, and time conventions. When the analyst later assembles these by-products into an analytical dataset, the measurement decisions of a dozen systems arrive embedded in the columns, mostly undocumented. This is why the analyst must learn to read a dataset the way an editor reads a manuscript: asking of every column where it came from, what rule produced it, and what it can and cannot support.
Definition
Measurement
Measurement is the assignment of numbers, labels, or categories to observations according to explicit rules. In marketing analytics, measurement translates marketing concepts (such as loyalty or engagement) into recorded variables (such as loyalty_tier or email_opt_in) through operational definitions.
Source: Adapted from Stevens (1946) and Churchill (1979).
Definition
Operational Definition
An operational definition is the specific, written rule by which a concept is turned into a recorded or computed value, including the population it applies to, the time window, and any filters or exclusions. Two analysts applying the same operational definition to the same data should obtain the same result.
Source: Adapted from Churchill (1979) and Carmines and Zeller (1979).
Two consequences of this view run through the rest of the chapter. First, because measurement is rule-governed, the rules can be written down, and Section 3.8 introduces the document in which teams write them: the data dictionary. Second, because measurement is a translation, the translation can fail: a column can measure its concept poorly (a validity problem, Section 3.6), inconsistently (a reliability problem, Section 3.6), or incorrectly (a data quality problem, Section 3.7). Before examining how measurement fails, however, the next section examines the most fundamental measurement decision of all: what one row of the dataset represents.
3.3 Units of Analysis and the Grain of a Dataset
The previous section described measurement as the translation of concepts into columns. This section examines the decision that comes before any column: what entity each row of a dataset describes, and what entity the analysis is actually making a claim about. In data-management practice the first of these is called the grain of a table — the answer to the question, “one row equals one what?” — and declaring it is treated as the first and most important step in designing a table (Kimball & Ross, 2013). The second is the unit of analysis: the entity about which the analysis makes its claim. Chapter 1 introduced the idea informally (Section 1.8), and the analytic specification in Chapter 2 required it to be named (Table 2.5). This section explains why the requirement exists, and why the two ideas, closely related as they are, are worth keeping apart.
The two usually coincide by the time an analysis is finished, and that is exactly what makes the distinction easy to lose. An analyst asking what share of customers repurchase wants a customer-grain table and will build one, at which point grain and unit of analysis agree. But the agreement is manufactured, not given. The available data may arrive at order-line grain while the claim is about people. The analyst’s job is then to move the data from the grain it has to the grain the claim requires, and — this is the part that gets skipped — to know that the move has been made. In other words, grain is a property of a table, unit of analysis is a property of a claim, and the work in between is aggregation.
Consider StyleCraft’s data family, which later chapters use throughout. It consists of five base tables, each with a different grain, summarized in Table 3.1. The transactions table is StyleCraft’s primary sales fact table: one row is one order line, carrying the quantitative measures — quantity, revenue, discount — that the company’s sales metrics aggregate. The customers, products, and stores tables are dimension tables: one row describes one entity and supplies the attributes by which the sales facts will later be sliced.
The campaigns table is the awkward case, and it is more useful to name the awkwardness than to smooth it over. It supplies descriptive attributes such as channel and campaign name, which makes it behave like a dimension; but it also carries spend, impressions, and clicks, which are additive measures in their own right, recorded at campaign grain. A table of that shape is better described as a campaign-level performance table with campaign attributes than as a pure dimension. Note in particular what it is not: campaign spend and impressions are not aggregations of sales transactions. They are separate facts, produced by a different system at a different grain, and bringing them together with sales is an analytical act rather than a roll-up.
Table 3.1
The StyleCraft base tables and their grain
Table | Grain (one row =) | Role | Example columns |
|---|---|---|---|
transactions | one order line | Primary sales fact table; carries the quantitative sales measures that sales metrics aggregate | order_date, quantity, unit_price, discount_pct, line_revenue |
customers | one customer | Dimension: who they are, how acquired, where, loyalty status | signup_date, acquisition_channel, age_band, loyalty_tier |
products | one product (SKU) | Dimension: category, price, cost, newness | category, unit_price, unit_cost, is_occasionwear |
stores | one physical store | Dimension: location, type, opening date | store_type, metro, opening_date |
campaigns | one marketing campaign | Campaign-level performance table: descriptive attributes plus its own quantitative campaign measures, not an aggregation of sales | channel, spend, impressions, clicks |
Definition
Fact Table and Dimension Table
A fact table records events or measurements at a declared grain and typically carries quantitative measures, many of which can be aggregated to construct metrics. A dimension table describes entities and supplies the attributes by which those measures are sliced, grouped, and filtered. A data family may contain more than one fact table: sales facts and campaign performance facts are recorded by different systems at different grains, and neither is derived from the other. A table carrying both entity attributes and its own quantitative measures, such as StyleCraft’s campaigns, is a performance table rather than a pure dimension.
Source: Adapted from Kimball and Ross (2013).
The grain matters because it determines what questions a table can answer directly. A question about baskets (“what is the average order value?”) requires order-level or finer-grained data, or a preaggregated table that already carries the revenue and order totals the metric needs. A question about people (“what share of customers repurchase?”) requires customer-level data, or transaction data that can be rolled up to customers. A question about the expansion (“how do store types compare?”) requires store-level data, or something that aggregates to it. None of these grains is more correct than the others. Each is an aggregation choice, and each choice discards information: rolling transactions up to customers discards which products were bought; rolling customers up to stores discards which customers did the buying.
3.3.1 Changing the Unit Changes the Claim
Aggregation is not merely a loss of detail; it can change the direction of a finding. Robinson (1950) demonstrated the classic version of the problem: a correlation computed across groups can differ in size, and even in sign, from the correlation computed across the individuals inside those groups. Inferring individual-level relationships from group-level data is known as the ecological fallacy, and marketing analytics offers it constant temptation, because marketing data is so often reported at the group grain — by store, by campaign, by segment, by week.
A StyleCraft example makes the danger concrete. At the store grain, average order value and repeat purchase rate are negatively related: the suburban and resort stores post high average order values and weak repeat rates, while the urban stores show the reverse (Lab 2.1). It would be natural, and wrong, to conclude from this that individual customers who spend more per order are less likely to return. The store-level pattern could be produced by differences in the customer mix across store types — the occasionwear buyer in Greenwich and the weekly-drop follower in SoHo — rather than by any within-customer trade-off between basket size and loyalty. This chapter cannot settle which explanation is right, and that restraint is the lesson: whether high-basket customers repurchase less is a customer-grain question, and only customer-grain data can answer it. Chapter 5 returns to this comparison explicitly; the point here is that the unit of analysis is part of the claim, not a technical footnote to it.
Therefore, two habits follow. First, every analytical question in a specification should name its unit of analysis, as Table 2.5 requires. Second, every reported number should be traceable to the grain at which it was computed, because a “rate” computed over stores and a “rate” computed over customers are different quantities even when they share a name — a lesson the pooled-versus-simple comparison in Lab 2.1 (Section 2.9.4) has already illustrated from the denominator side.
Definition
Grain and Unit of Analysis
The grain of a table is what one row represents: one order line, one order, one customer, one store, one campaign, one day. In dimensional modeling, declaring the grain is the first design decision a table makes. The unit of analysis of an analytical question is the entity about which the analysis makes its claim.
The two usually align once the data has been prepared, but they are declared separately and can come apart: an analyst may begin with order-line-grain data and make a customer-level claim after aggregation. The obligation is to know, at every step, which one is being talked about.
Source: Adapted from Kimball and Ross (2013) and Robinson (1950).
Concept
The Ecological Fallacy in Marketing
The ecological fallacy is the error of inferring individual-level relationships from group-level data. Marketing dashboards report mostly at group grains (store, campaign, segment, week), so the fallacy is a constant occupational hazard: store-level patterns need not hold customer by customer, and campaign-level patterns need not hold impression by impression. The protection is to match the grain of the data to the grain of the claim.
Source: Adapted from Robinson (1950).
So far this chapter has established what measurement is and what one row represents. The next section classifies what the columns themselves contain.
3.4 Types of Variables and Levels of Measurement
The previous section examined the rows of a dataset. This section examines the columns. A variable is any characteristic recorded for each unit of analysis, and it is widely accepted that not all variables carry the same kind of information. Stevens (1946) proposed the classification that analytics still uses: variables can be measured at the nominal, ordinal, interval, or ratio level, and each level licenses a different set of mathematical operations.
Nominal variables are labels without order. StyleCraft’s acquisition_channel (TikTok, Instagram, Paid Search, Referral, In-Store, Influencer, Email) names categories, but no channel is “greater than” another. The permissible summaries are counts, proportions, and the mode. Identifiers deserve special mention here: customer_id and order_id are nominal labels even when they look numeric, and averaging or summing them is meaningless. Treating an identifier as a quantity is one of the most common silent errors in AI-generated analysis code, which is one reason this classification is worth internalizing rather than delegating.
Ordinal variables are ordered categories with undefined distances. StyleCraft’s loyalty_tier (None < Insider < VIP < Backstage) and age_band (18–24 through 55+) carry a genuine order, so medians, percentiles, and comparisons such as “VIP or above” are meaningful. However, the distances between categories are not defined: the “gap” between Insider and VIP is not a quantity, so means and differences are not, strictly speaking, licensed. Marketing data is dense with ordinal variables — tiers, bands, ratings, ranks — and much practical judgment concerns how strictly to honor their ordinal character. Survey research, for example, routinely averages rating scales, a practice that is defensible in some settings and contested in others; the analyst should at minimum know that a choice is being made (Stevens, 1946; Velleman & Wilkinson, 1993).
Interval variables have meaningful distances but no true zero. Calendar dates are the clearest marketing example: the difference between two order_date values is a meaningful duration, but the “zero” of a calendar is a convention, so ratios of dates are meaningless — June 2026 is not “twice” March 1013. Usefully, differences of interval variables often become ratio variables: tenure in days, computed as order_date minus signup_date, has a true zero and supports full arithmetic.
Ratio variables have meaningful distances and a true zero, so all arithmetic, including ratios, is licensed. Most StyleCraft quantities live here: quantity, unit_price, line_revenue, spend, impressions, clicks. A campaign with $40,000 of spend really did spend twice as much as one with $20,000.
Table 3.2 summarizes the four levels with StyleCraft examples. The classification is a working tool rather than a law of nature — Velleman and Wilkinson (1993) document its limits — but as a first pass over an unfamiliar dataset, “what level is this column?” remains among the most productive questions an analyst can ask.
Table 3.2
Levels of measurement with StyleCraft examples
Level | What it carries | StyleCraft examples | Permissible summaries | Not permissible |
|---|---|---|---|---|
Nominal | Category labels, no order | acquisition_channel, channel, gender, store_name, customer_id | Counts, proportions, mode | Any arithmetic; averaging identifiers |
Ordinal | Ordered categories, undefined distances | loyalty_tier, age_band | Median, percentiles, order comparisons (“VIP or above”) | Means and differences (strictly) |
Interval | Meaningful distances, no true zero | order_date, signup_date | Differences (durations), medians, means of differences | Ratios (“date A is twice date B”) |
Ratio | Meaningful distances and a true zero | quantity, unit_price, line_revenue, spend, clicks | All arithmetic, including ratios and rates | — |
3.4.1 From Measurement Levels to Stored Data Types
Levels of measurement describe what a variable means. Data types describe how software stores it, and the two classifications do not coincide. In pandas, the Python library used throughout this guide, a column arrives as an integer (int), a decimal (float), a Boolean (bool), a datetime, or — for anything textual — a general-purpose type whose name depends on the version in use. Versions before pandas 3.0 report text columns as the generic object type; pandas 3.0 changed the default so that text is inferred as a dedicated str type (pandas development team, n.d.). The interpretive situation is identical under either name. Nothing in the stored type records whether a text column is nominal or ordinal, whether an integer is a quantity or an identifier, or whether a float is a price or a percentage. The meaning lives in the analyst’s head, or in the data dictionary, but not in the file.
The mismatch runs in both directions and both directions cause errors. A meaningful order can be invisible to the software: loyalty_tier arrives as plain text, so sorting it yields alphabetical order (Backstage, Insider, None, VIP) rather than tier order, and “VIP or above” cannot be expressed until the analyst declares the ordering, which pandas supports through ordered categorical types (the lab in Section 3.10 does exactly this). Conversely, an order the software offers can be meaningless: a numeric-looking identifier will happily produce an average if asked. Furthermore, Booleans quietly straddle the classification: email_opt_in is a nominal yes/no in meaning, yet because True is stored as 1 and False as 0, its mean is a legitimate and useful quantity — the opt-in rate. The habit this subsection recommends is a small, repeatable check performed on every new dataset: list the stored types, state the intended measurement level of each column, and reconcile the two before computing anything. That check is the heart of Lab 3.1.
Concept
Why the Classification Matters Later
The level of measurement governs three choices that recur in every subsequent chapter: which summary statistics are meaningful (Chapter 5), how a variable must be encoded before modeling — for example, nominal variables becoming dummy variables in regression (Chapter 7) — and which chart types are appropriate, since bar charts suit categories while histograms and scatterplots suit quantities (Chapter 12). Misclassifying a variable at this stage propagates into wrong summaries, wrong encodings, and wrong charts later.
Source: Course concept developed for this guide, informed by Stevens (1946) and Velleman and Wilkinson (1993).
3.5 Metrics, KPIs, Dimensions, and Features
The previous section classified variables by what they carry. This section classifies analytic work by the role a quantity or an attribute plays in it, because one business concept — and sometimes one underlying field — can appear in four different positions. The four role words — metric, KPI, dimension, and feature — are used constantly in marketing organizations, frequently interchangeably, and the confusion is not harmless: calling every metric a “KPI” inflates dashboards until nothing is key, and confusing dimensions with features muddles the transition from reporting to modeling in Part II of this guide.
A metric is a quantity computed from data by an explicit rule, at a stated grain, for the purpose of description or comparison. Average order value, repeat purchase rate, conversion rate, return on ad spend, and cost per acquisition are metrics. Standard references catalog hundreds of marketing metrics precisely because the discipline’s quantities are conventional, not natural: each exists only as its definition (Farris et al., 2010). Appendix B collects the definitions used in this guide.
A key performance indicator is a metric that an organization has elevated: attached to a target, assigned an owner, reviewed on a cadence, and connected to strategy. The KPI literature insists that the K is doing real work — an organization can compute hundreds of metrics but can attend to only a handful of KPIs, and indicators that merely describe results differ from those that anyone can act on (Parmenter, 2015). Elevation also has a cost that Chapter 2 examined: once a metric becomes a target, behavior reorganizes around it and the measure degrades as evidence (Campbell, 1979; Strathern, 1997). Choosing KPIs is therefore a managerial act with side effects, not a technical selection.
A dimension is an attribute used to slice, group, or filter metrics: store_type, acquisition_channel, age_band, category, month. Dimensions are usually nominal or ordinal variables drawn from the dimension tables of Section 3.3, and “metric by dimension” — repeat rate by store type, revenue by channel — is the basic grammatical unit of descriptive analytics and of every dashboard in Part III.
A feature is a variable prepared as an input to a model: recency in days, order frequency, discount share of purchases, tenure, opt-in flags. The word belongs to Part II of this guide, where models predict spend (Chapter 8) or churn (Chapter 9) from features. Features are frequently engineered — computed from raw columns at the model’s unit of analysis — and feature representation and engineering are often among the most consequential parts of model development (Domingos, 2012). A dimension used for slicing today often reappears, encoded, as a feature tomorrow.
One asymmetry among the four is worth naming, because a compact table can obscure it. Metrics and KPIs are ordinarily computed quantities: they do not sit in the data waiting to be read, they are produced by a rule. Dimensions and features are roles played by fields that already exist, or that have been engineered into existence. So these are not four uses of one column. They are four positions that one business concept can occupy in analytic work, and only some of those positions are occupied by a column. Table 3.3 arranges the four around a single StyleCraft concept, repeat purchase, to make the distinctions concrete.
Table 3.3
One concept, four roles: repeat purchase at StyleCraft
Role | What it is | Repeat-purchase example | Where it appears in this guide |
|---|---|---|---|
Metric | A quantity computed by an explicit rule at a stated grain | Repeat purchase rate: repeat customers ÷ active customers, trailing 12 months | Chapter 2 lab; Chapter 5 |
KPI | A metric elevated with a target, owner, and review cadence | Repeat rate ≥ 45%, owned by the CRM manager, reviewed monthly against the expansion decision | Chapter 2 (Section 2.12); Chapter 13 dashboards |
Dimension | An attribute used to slice or filter metrics | Repeat rate by store_type, by acquisition_channel, by age_band | Chapter 5 cross-tabs; Chapters 12–13 |
Feature | A variable prepared as a model input | repeat_flag or purchase frequency as an input to the churn model | Chapters 6–9 |
3.5.1 The Anatomy of a Ratio Metric
Most marketing metrics are ratios, and the Chapter 1 and Chapter 2 labs have already shown that ratios conceal their most consequential choices in the denominator (Exercise 1.10, item 2, “The Averaged Average,” and Section 2.9.4). This subsection generalizes the lesson: a ratio metric is not fully defined until four elements are written down.
First, the numerator: what is being counted or summed, under what rule. Second, the denominator: the population, exposure, or base against which the numerator is expressed. For many customer- or event-based rates the denominator also reveals the entity being counted, but that is a convenience rather than a rule — return on ad spend divides by dollars of spend while the unit of analysis is usually the campaign — so the metric’s unit of analysis should still be stated separately. Third, the time window: over what period both are accumulated, and as of when. Fourth, the filters: which records are included or excluded — channels, statuses, test customers, returns, cancelled orders.
The Section 3.1 dispute is precisely a disagreement across these four elements. All three teams counted “customers with two or more purchases” in the numerator; they diverged on the denominator (customers with at least one completed order in the available company history, versus customers active in the window, versus customers who shopped in a store), on the window (lifetime versus trailing twelve months), and on the filters (all channels versus stores only). Written this way, the dispute stops being mysterious and becomes tractable: the organization does not need to decide which number is true; it needs to decide which definition serves the decision at hand, and to record the definition so the question stays settled. Section 3.8 shows where such definitions live, and the lab in Section 3.10 computes all three from the same miniature dataset.
Definition
Metric
A metric is a quantity computed from data by an explicit rule for description or comparison. A ratio metric is completely specified only when its numerator, denominator, time window, and filters are stated.
Source: Adapted from Farris et al. (2010).
Definition
Key Performance Indicator (KPI)
A key performance indicator is a metric that an organization has elevated to guide action: connected to strategy, attached to a target, assigned an owner, and reviewed on a regular cadence. Because targets reshape behavior, the selection of KPIs is a managerial decision with side effects, not a purely technical one.
Source: Adapted from Parmenter (2015), Campbell (1979), and Strathern (1997).
Definition
Dimension and Feature
A dimension is an attribute used to slice, group, or filter metrics in descriptive analysis and dashboards. A feature is a variable prepared as an input to a predictive model, often engineered from raw columns at the model’s unit of analysis. The same underlying field can serve as a dimension in reporting and, suitably encoded, as a feature in modeling.
Source: Adapted from Kimball and Ross (2013), Provost and Fawcett (2013), and Domingos (2012).
3.6 Measurement Validity and Reliability
So far this chapter has treated measurement decisions as choices among defensible alternatives. This section examines how measurement fails. The classical vocabulary distinguishes two failure modes: a measure can fail to capture the concept it claims to capture, which is a validity problem, or it can capture something inconsistently, which is a reliability problem (Carmines & Zeller, 1979).
Validity asks: does this measure measure what we say it measures? The question sounds abstract until it is aimed at a familiar column. Does email_opt_in measure interest in the brand, or does it measure the aggressiveness of the signup flow in force when the customer joined? Does loyalty_tier measure loyalty, or does it measure enrollment — a customer’s willingness to complete a form — which the Suburban Occasion shopper profile suggests can diverge sharply from actual attachment to the brand? Does a click measure interest, or curiosity, or a misplaced thumb? In each case the column is a valid measure of something; the validity question is whether it is a valid measure of the concept the analysis names. Marketing researchers develop the question into finer distinctions — content validity (does the measure cover the concept?), construct validity (does it behave as the concept should?), and criterion validity (does it predict what the concept should predict?) — and while formal validation belongs to research methods courses, the working analyst needs at least the reflex of asking the question (Churchill, 1979; Carmines & Zeller, 1979).
Reliability asks: would the measure give the same answer under repetition? A survey question that respondents interpret differently on different days is unreliable; so is a “store visits” figure produced by a sensor that undercounts on crowded days, or a revenue feed that a source system restates for forty-eight hours after each day closes. Reliability is a precondition for validity — a measure that will not sit still cannot be measuring the concept well — but it is not a substitute for it: a scale that is consistently wrong by two kilograms is perfectly reliable and invalid.
3.6.1 Proxy Measures
Marketing analytics runs on proxies: measures adopted to stand in for concepts that are not directly observable. Repeat purchase rate stands in for loyalty; clicks stand in for interest; email opens stand in for attention; loyalty_tier stands in for relationship depth. Proxies are not a failure of practice — they are unavoidable, since loyalty itself is never a column — but each proxy imports assumptions, and the assumptions can fail silently. A striking demonstration comes from outside marketing: a widely used healthcare algorithm used medical costs as a proxy for medical need, and because less money was historically spent on Black patients at the same level of illness, the proxy systematically understated their need (Obermeyer et al., 2019). The proxy was convenient, computable, and consequentially wrong. Marketing’s proxies deserve the same scrutiny: a repeat-rate proxy for loyalty, for example, will understate the loyalty of customers whose category purchase cycle is naturally long — the occasionwear buyer may be devoted and still shop twice a year. Section 3.13 returns to the ethics of this point.
Finally, validity connects back to Chapter 2’s discussion of metric gaming (Section 2.12). When a proxy becomes a target, people optimize the proxy rather than the concept, and the gap between them widens: enrolling every walk-in customer in the loyalty program raises loyalty_tier statistics while measuring loyalty less validly than before. Validity is therefore not a one-time property of a measure; it can be eroded by the very act of managing to it. That is the risk StyleCraft is about to take on, since Section 3.1 established that whichever repeat-rate definition wins will become a team target.
Definition
Validity
Validity is the degree to which a measure captures the concept it is intended to capture. In marketing analytics the question is most often aimed at proxies: whether repeat purchase validly measures loyalty, whether clicks validly measure interest, whether tier enrollment validly measures relationship depth.
Source: Adapted from Carmines and Zeller (1979) and Churchill (1979).
Definition
Reliability
Reliability is the degree to which a measure produces consistent results under repeated or equivalent measurement. Reliability is necessary but not sufficient for validity: a consistently biased measure is reliable and invalid.
Source: Adapted from Carmines and Zeller (1979).
3.7 Data Quality: Dimensions and Common Defects
Validity and reliability concern whether the right thing is being measured. Data quality concerns whether the recorded values are fit for use at all. The two concerns are related but distinct: a dataset can record a perfectly valid measure full of typing errors, and a pristine dataset can record an invalid proxy flawlessly. Research on data quality converges on the view that quality is multidimensional and defined by fitness for the consumer’s use, not by any single property of the file (Wang & Strong, 1996). The six dimensions used below are an operational synthesis for this guide, informed by Wang and Strong’s consumer-centered framework and by Redman’s (1998) account of how quality failures propagate through an enterprise; neither source states this exact six-item taxonomy.
Accuracy asks whether values reflect reality: a price recorded as $2,400 for a $24.00 top is inaccurate, most likely through a decimal error at entry. Completeness asks whether values that should be present are present — and, more subtly, what an absence means. In StyleCraft’s transactions, a missing campaign_id may be legitimately null (the order was not attributable to any campaign) or truly missing (the attribution failed); the two absences look identical in the file and mean opposite things for any campaign analysis. Consistency asks whether the same fact is recorded the same way everywhere: a channel column containing “Online,” “online,” and “web” is inconsistent, and a naive group-by will report three channels where one exists. Uniqueness asks whether each real-world event appears exactly once: fully duplicated order lines inflate revenue, and near-duplicates — the same order re-exported with a different timestamp — inflate it while evading the obvious duplicate check. Timeliness asks whether the data is current enough for the decision, and whether late-arriving records will restate figures already reported. Finally, conformity (sometimes called validity in the data-quality literature, a regrettable collision with Section 3.6’s usage) asks whether values respect their declared type, format, and allowed range: an order_date before the customer’s signup_date, a quantity of 999, a price stored as the string “$45.00” rather than the number 45.00.
Table 3.4 summarizes the six dimensions with StyleCraft examples. Readers may notice that the examples are suspiciously specific. They are: the StyleCraft raw files used in Chapter 4 ship with a documented catalog of planted defects spanning exactly these categories, and Chapter 4’s lab is the work of finding and remedying them. This chapter’s job is to supply the vocabulary; the next chapter’s job is the repair.
Table 3.4
Data quality dimensions with StyleCraft examples
Dimension | Question it asks | StyleCraft example (Chapter 4 preview) |
|---|---|---|
Accuracy | Do values reflect reality? | Prices outside the $24–$90 catalog band; implausible quantities such as 999 |
Completeness | Are expected values present, and what does an absence mean? | Missing age_band; campaign_id that is legitimately null versus truly missing |
Consistency | Is the same fact recorded the same way everywhere? | “Online” / “online” / “web” in the channel column; “Occasionwear” / “occasion wear” |
Uniqueness | Does each event appear exactly once? | Fully duplicated order lines; near-duplicates re-exported with new timestamps |
Timeliness | Is the data current enough, and stable once reported? | Recent stores with short histories; feeds that restate recent days |
Conformity | Do values respect type, format, and allowed ranges? | order_date before signup_date; numbers arriving as strings with currency symbols |
Two habits follow for the working analyst. First, data quality is assessed against use: a duplicate rate that is immaterial for a company-level revenue trend may be fatal for a customer-level churn model, so “is this data good?” is always shorthand for “is this data good enough for this decision?” (Wang & Strong, 1996; Redman, 1998). Second, known defects belong in the documentation, not in the analyst’s memory. A column’s data dictionary entry, introduced next, has a field for exactly this purpose.
Definition
Data Quality
Data quality is the degree to which data is fit for its intended uses, assessed along dimensions including accuracy, completeness, consistency, uniqueness, timeliness, and conformity to declared formats and ranges. Quality is judged relative to the decision the data supports, not as an absolute property of a file.
Source: Course synthesis for this guide, informed by Wang and Strong (1996) and Redman (1998).
3.8 The Data Dictionary
The preceding sections have accumulated a list of things that must be written down: the grain of each table, the intended measurement level of each column, the operational definition behind each metric, the known quality issues. This section introduces the document where they are written: the data dictionary. A data dictionary is a shared, maintained reference that records, for every table and column in a data family — and, in the extended form this guide recommends, for every named metric — what it means, how it is typed, what values it may take, where it comes from, and what is known to be wrong with it (Kimball & Ross, 2013).
The case for the dictionary is the case against private knowledge. Without a dictionary, every column’s meaning lives in the heads of whoever loaded it last, definitions drift as staff turn over, and disputes like Section 3.1’s are not resolved but merely adjourned. With a dictionary, a new analyst can be productive in days rather than months, AI assistants can be given accurate context instead of guessing at column meanings (Section 3.9), and a metric definition, once agreed, stays agreed. The dictionary is to a data family what the analytic specification (Section 2.5) is to a single project: a small written discipline that prevents large silent failures.
A useful column entry records at least eight things: the column name; the table and grain it belongs to; a one-sentence plain-language definition; the stored data type; the intended level of measurement; the allowed values or range; the source system or derivation rule; and known issues. Table 3.5 shows entries for five StyleCraft columns in this format. The entries are deliberately short — a dictionary that is painful to read will not be read — and deliberately candid: the known-issues field for campaign_id records the null-versus-missing ambiguity rather than hiding it.
Table 3.5
Data dictionary entries for selected StyleCraft columns
Column (table) | Definition | Type / Level | Allowed values | Source / Known issues |
|---|---|---|---|---|
loyalty_tier (customers) | Customer’s current tier in the VIP loyalty program | categorical / ordinal | None < Insider < VIP < Backstage | Loyalty platform; measures enrollment, not attachment — see Section 3.6.1 |
age_band (customers) | Self-reported age at signup, bucketed | categorical / ordinal | 18–24, 25–34, 35–44, 45–54, 55+ | Signup form; optional, so some values missing; banded for privacy |
discount_pct (transactions) | Discount applied to the line, as a proportion | float / ratio | 0 to 0.80 | E-commerce and POS; 0 means full price; small share missing in raw file |
campaign_id (transactions) | Campaign to which the line is attributed | str / nominal (identifier) | Valid campaign key or null | Attribution pipeline; null is legitimate (unattributed) but some nulls are attribution failures |
line_revenue (transactions) | quantity × unit_price × (1 − discount_pct) | float / ratio | ≥ 0 | Derived; recompute to verify rather than trusting the stored value |
3.8.1 Metrics Belong in the Dictionary Too
Column entries are necessary but not sufficient, because the disputes that damage organizations are usually about computed quantities rather than raw columns. The extended dictionary therefore includes metric entries, each recording the four elements of Section 3.5.1 — numerator, denominator, window, filters — together with the grain, the owner, and the decision the metric informs. The last two fields do work the first four cannot. An unowned definition has no one to defend it when a new dashboard quietly redefines it, and a definition with no stated decision use cannot be evaluated, because fitness for use is the only standard a metric can be judged against (Section 3.7).
Table 3.6 writes the three repeat purchase rates from the opening case in exactly this format. Set side by side, the three entries make the meeting’s confusion almost impossible to reproduce: the numbers differ because the definitions differ, and the definitions now differ in writing.
Table 3.6
Three metric definitions behind one metric name
Element | “Lifetime” version (Retail) | “Trailing 12M” version (CRM) | “Store” version (Finance) |
|---|---|---|---|
Numerator | Customers with ≥ 2 orders ever | Customers with ≥ 2 orders in window | Customers with ≥ 2 store orders in window |
Denominator | All customers with ≥ 1 completed order in the available history | Customers with ≥ 1 order in window | Customers with ≥ 1 store order in window |
Window | Entire available history to the analysis date | Trailing 12 months to the analysis date | Trailing 12 months to the analysis date |
Filters | All channels | All channels | Store channel only |
Grain | Customer | Customer | Customer |
Metric owner | Vice president of retail | CRM manager | Finance, retail economics |
Decision or business use | Long-run brand narrative; not suitable for period-over-period comparison | Headline retention tracking; baseline for the expansion review | Economics of the physical footprint; store-level go/no-go |
Value in the Lab 3.1 preview | 0.60 | 0.43 | 0.20 |
One more distinction is worth drawing before the machinery is put to use. The dictionary does not decide which definition is right; it makes the alternatives comparable so that the decision-maker can choose. Section 3.11 argues that for the expansion decision, the trailing-window definition is the most defensible headline, with the store version reported alongside it — but that is a judgment about the decision, reached with the dictionary’s help, not a fact the dictionary contains.
Definition
Data Dictionary
A data dictionary is a shared, maintained document that records, for each table, its grain; for each column, its definition, type, level of measurement, allowed values, source, and known issues; and, in the extended form used in this guide, for each named metric, its numerator, denominator, window, filters, grain, owner, and the decision it informs.
Source: Adapted from Kimball and Ross (2013); the metric extension is an operational course convention.
3.9 AI as a Measurement and Documentation Assistant
The previous sections described work — typing columns, drafting definitions, assembling dictionaries — that is exactly the kind of structured, patterned labor AI assistants accelerate well. Consistent with the guide’s stance (Sections 1.9 and 2.8), this section identifies where the assistance genuinely helps and where the analyst must not delegate.
The genuine help is substantial. Given a sample of rows, an assistant can draft a plausible data dictionary in minutes: inferring that a column is categorical, guessing allowed values from the observed ones, and writing serviceable one-sentence definitions. It can propose the four-element definition of a vague metric (“what would ‘active customer’ need to mean for this table?”), flag columns whose names and contents disagree, and translate a schema into plain language for a stakeholder. For the tedious first draft of documentation, the assistant is close to ideal.
The risks are equally specific. First, inference from a sample is not knowledge of a system: an assistant seeing only values 0 to 0.4 in discount_pct will confidently document the allowed range as 0 to 0.4, when the true business rule permits up to 0.8. Second, assistants complete ambiguity fluently: asked to define repeat purchase rate, an assistant will produce a definition — some definition — and a definition that arrives fluently is easily mistaken for the organization’s definition, which is precisely how the Section 3.1 problem gets automated rather than solved. Third, assistants inherit the file’s silences: nothing in the data reveals that campaign_id nulls come in two kinds, so no assistant will document it unprompted. The general pattern is the one this guide keeps encountering: the assistant drafts, and the analyst remains responsible for everything the data does not itself contain — business rules, definitional authority, and known history.
The countermeasure is the predict-then-verify habit applied to schema work. Before asking an assistant to infer types, write down the expected type and level of each column; then compare. Before accepting a drafted metric definition, check each of the four elements against the decision the metric serves. Moreover, dictionary drafts should be audited with the source-system owners, who hold the knowledge no file contains.
AI in Practice
Draft the Dictionary, Audit the Draft
A productive pattern: paste a small sample of rows (never confidential data; the synthetic StyleCraft files are safe) and prompt, “Draft a data dictionary entry for each column: definition, type, level of measurement, allowed values, and one plausible known issue. Mark any column where you are guessing.”
Then audit the draft: verify allowed values against business rules rather than observed values, correct the measurement levels, and add the issues only humans know. Document the exchange per Appendix D. The assistant’s “known issue” guesses are often generic, but occasionally an assistant flags a real ambiguity the analyst had stopped seeing.
3.10 Hands-On Application in Python and Google Colab
The preceding sections were conceptual. This section moves from concepts to practice by putting the chapter’s two central skills — reconciling stored types with measurement levels, and defining metrics precisely — to work on a miniature version of the opening case. As in Chapters 1 and 2, the lab uses a compact dataset created directly in Python so that every number can be verified by hand; it is constructed to reproduce, in miniature, the pattern of the three numbers from the Section 3.1 meeting. Later chapters load StyleCraft’s full data family from the companion repository, accompanied by the student-facing data dictionary this chapter has been building toward.
3.10.1 Lab 3.1: Reading the Types Before Trusting the Table
The lab begins with a ten-customer preview of StyleCraft’s customers table and an eighteen-order preview of its orders. Before running anything, apply predict-then-verify to the types themselves. The predictions belong on paper, not in memory.
Verification Check
Before you run: customer_id should be text; signup_date should be a date; acquisition_channel should be an unordered category; age_band and loyalty_tier should be ordered categories; email_opt_in should be Boolean. The customers frame should report ten rows and six columns, the orders frame eighteen rows and three columns. Every repeat purchase rate, being a proportion, must fall between 0 and 1.
After you run: pandas should report a Boolean type for email_opt_in and a single generic text type for all five remaining columns — object in versions before 3.0, str in 3.0 and later. Five of the six predictions about meaning will therefore appear to fail, which is the point of the exercise rather than an error. After the conversions in Code 3.2, the highest tier present should be VIP and four customers should be Insider or above. The three rates in Code 3.4 should be 0.60, 0.43, and 0.20.
Investigate if: any rate falls outside 0 and 1; either frame reports a shape other than (10, 6) or (18, 3); or a rate changes when the notebook is rerun on a later date, which would indicate a window boundary that depends on the day of execution rather than on the stated analysis date.
Code 3.1. Create the customer preview
import pandas as pd
print("pandas version:", pd.__version__)
customers = pd.DataFrame({
"customer_id": ["C01", "C02", "C03", "C04", "C05",
"C06", "C07", "C08", "C09", "C10"],
"signup_date": ["2024-05-12", "2024-10-01", "2025-09-20",
"2025-07-30", "2024-08-15", "2025-12-28",
"2025-10-05", "2024-07-01", "2026-05-22",
"2025-01-10"],
"acquisition_channel": ["Instagram", "TikTok", "In-Store",
"Instagram", "Paid Search", "Referral",
"Email", "In-Store", "TikTok",
"Influencer"],
"age_band": ["18-24", "25-34", "45-54", "25-34", "35-44",
"18-24", "25-34", "55+", "18-24", "35-44"],
"loyalty_tier": ["Insider", "None", "None", "VIP", "None",
"Insider", "None", "None", "None", "Insider"],
"email_opt_in": [True, True, False, True, False,
True, True, False, True, True]
})
print(customers.shape)
customers.dtypes
Expected output: the shape (10, 6); email_opt_in reports bool; customer_id, signup_date, acquisition_channel, age_band, and loyalty_tier all report the same generic text type — object under pandas 2.x, str under pandas 3.0 and later.
The version line is printed deliberately. Colab environments change underneath a course, and the name of the text type is one of the things that changed: pandas 3.0 made a dedicated str type the default, where earlier versions reported object (pandas development team, n.d.). The interpretive question is identical under either name, which is the lesson.
Compare the output with the predictions. The Boolean survived. Everything else arrived as one undifferentiated text type, including signup_date, which is currently a string that merely looks like a date. Nothing in the file records that loyalty_tier is ordered, that age_band is banded, or that customer_id is a label rather than data. The stored types have discarded most of the measurement information, exactly as Section 3.4.1 warned.
3.10.2 Declaring the Measurement Levels
The next cell restores the discarded meaning. Dates become datetimes; acquisition_channel becomes an unordered category; age_band and loyalty_tier become ordered categories, so that the software finally knows what the loyalty program knows. All four conversions are performed here, because a reconciliation that stops halfway leaves exactly the columns most likely to be misinterpreted still undeclared.
Code 3.2. Align stored types with intended measurement levels
# Interval: a real date, not a string that looks like one
customers["signup_date"] = pd.to_datetime(customers["signup_date"])
# Nominal: an unordered category
customers["acquisition_channel"] = pd.Categorical(
customers["acquisition_channel"], ordered=False
)
# Ordinal: ordered categories, declared in the order the business uses
band_order = ["18-24", "25-34", "35-44", "45-54", "55+"]
customers["age_band"] = pd.Categorical(
customers["age_band"], categories=band_order, ordered=True
)
tier_order = ["None", "Insider", "VIP", "Backstage"]
customers["loyalty_tier"] = pd.Categorical(
customers["loyalty_tier"], categories=tier_order, ordered=True
)
print(customers.dtypes)
# Ordinal operations are now meaningful
print(customers["loyalty_tier"].max())
print((customers["loyalty_tier"] >= "Insider").sum())
# A permissible mean: the Boolean straddle from Section 3.4.1
print(customers["email_opt_in"].mean())
Expected output: signup_date reports a datetime type; the three converted columns report category; the highest tier present is VIP; four customers are Insider or above; the opt-in rate is 0.7.
Three verification checks close the loop, and each one demonstrates a different way the declaration earns its keep. First, sorting by loyalty_tier now yields tier order rather than alphabetical order; before the conversion it would have placed “None” between “Insider” and “VIP,” a quietly wrong ordering that a chart would have faithfully displayed. Second, customers["age_band"].mean() raises a TypeError, because averaging an ordered category is not licensed — and note that the declaration, not luck, is what produces the error. Had ages been stored as numeric midpoints, the impermissible average would have computed without complaint. Third, customers["acquisition_channel"].max() also raises, with the message that the category is not ordered. Declaring a variable nominal is not bookkeeping; it installs a guardrail that Section 3.4 could only describe.
3.10.3 One Metric Name, Three Numbers
The lab now reconstructs the opening dispute. A compact orders table records eighteen orders by the ten customers over StyleCraft’s twenty-four-month window. The analysis date is June 30, 2026, so the trailing-twelve-month window opens on July 1, 2025.
Code 3.3. Create the order preview
orders = pd.DataFrame({
"customer_id": ["C01", "C01", "C01", "C02", "C02", "C03",
"C04", "C04", "C04", "C05", "C06", "C06",
"C07", "C08", "C08", "C09", "C10", "C10"],
"order_date": pd.to_datetime([
"2024-08-10", "2025-09-14", "2026-02-02", "2024-11-05",
"2025-01-20", "2025-10-03", "2025-08-19", "2025-12-24",
"2026-05-30", "2024-09-01", "2026-01-15", "2026-01-28",
"2025-11-11", "2024-07-22", "2026-04-10", "2026-06-06",
"2025-02-14", "2025-05-02"]),
"channel": ["Store", "Store", "Online", "Online", "Online",
"Store", "Online", "Store", "App", "Store",
"Store", "Store", "Online", "Store", "Store",
"App", "Store", "Store"]
})
orders.shape
Expected output: (18, 3).
Before computing, predict — and be careful about what kind of claim the prediction is. After inspecting these eighteen rows, we expect the lifetime version to be the largest, because every customer who ever repurchased keeps counting, and the store-only version to be the smallest, because it discards two channels from the numerator and the denominator alike. That ordering is a prediction about these particular records, not a mathematical property of the three definitions. A lifetime denominator grows along with its numerator, and filtering to stores can raise a rate as easily as lower it, depending on which customers survive the filter. Predicting the ordering and then noticing that it was contingent is itself the predict-then-verify lesson.
Code 3.4. Compute the three repeat purchase rates
analysis_date = pd.Timestamp("2026-06-30")
window_start = pd.Timestamp("2025-07-01")
# Definition A (Retail): all history up to the analysis date,
# customers with at least one order on record
history_to_date = orders[orders["order_date"] <= analysis_date]
lifetime_orders = history_to_date.groupby("customer_id").size()
rate_a = (lifetime_orders >= 2).mean()
# Definition B (CRM): trailing 12 months, customers active in the window
in_window = orders[
orders["order_date"].between(window_start, analysis_date)
]
window_orders = in_window.groupby("customer_id").size()
rate_b = (window_orders >= 2).mean()
# Definition C (Finance): store channel only, trailing 12 months
store_window = in_window[in_window["channel"] == "Store"]
store_orders = store_window.groupby("customer_id").size()
rate_c = (store_orders >= 2).mean()
print(round(rate_a, 2), round(rate_b, 2), round(rate_c, 2))
Expected output: 0.60 0.43 0.20.
Two details of this cell are places where a plausible implementation drifts away from the written definition. The first is Definition A’s denominator. The lifetime rate is computed by grouping the orders table, so its base is customers with at least one order on record — which is why Table 3.6 states the denominator that way rather than as “all customers on file.” In this preview every customer has ordered, so both phrasings give 0.60; in a real CRM they would not, because customers who signed up and never purchased sit in customers and never appear in orders. A repeat rate among purchasers is a defensible metric, but it has to be the stated one. Reindexing the counts against the full customers table, so non-purchasers enter as zeros, is a different metric and belongs in the dictionary under a different name.
The second is the window. Definitions B and C are bounded on both sides, using between with an explicit analysis_date rather than keeping everything at or after the window start. A one-sided filter admits future-dated and mistyped orders, and it quietly makes the reported rate depend on the day the notebook happens to run. A trailing window needs a beginning and an “as of” date, which is why the third element of a metric definition is a window rather than a start date. Note that Definition A takes the same “as of” bound even though it has no start: a lifetime metric is still measured up to a date, and imposing that bound is what makes the code enforce the definition the dictionary publishes. These eighteen rows contain no future-dated orders, so the figure stays 0.60 — which is precisely the situation in which a missing boundary goes unnoticed until the day it does not.
The three slides from the meeting have now been reproduced from a single, fully visible dataset of eighteen rows. It is worth pausing on what the code makes explicit that the meeting left implicit: each definition filters a different set of rows and groups over a different base of customers. Definition A’s denominator is all ten customers; Definition B’s is the seven customers active in the window; Definition C’s is the five customers with a store order in the window. The numerators shrink in parallel: six lifetime repeaters, three in-window repeaters, one in-window store repeater — C06, whose two January store visits make the point that a base of five customers turns a single person into twenty percentage points, a small-denominator caution that Chapter 5 develops.
3.10.4 Writing the Dictionary Entry
The final step converts the computation into documentation, building the metric portion of a data dictionary as a small table of its own. The frame carries the owner and the decision use alongside the four defining elements, in the same wording as Table 3.6: a definition without an owner has no one to defend it, and a definition without a stated use cannot be judged fit for anything. Note also that the recorded values are the computed variables rather than numbers typed in by hand. Hardcoding 0.60, 0.43, and 0.20 would work today and would silently stop matching the analysis the first time a definition changed — the documentation drifting from the computation is the same failure this chapter opened with, in miniature.
Code 3.5. Record the three definitions as dictionary entries
metric_dictionary = pd.DataFrame({
"metric_name": ["repeat_rate_lifetime", "repeat_rate_t12m",
"repeat_rate_store_t12m"],
"numerator": ["customers with >= 2 orders ever",
"customers with >= 2 orders in window",
"customers with >= 2 store orders in window"],
"denominator": ["all customers with >= 1 completed order "
"in the available history",
"customers with >= 1 order in window",
"customers with >= 1 store order in window"],
"window": ["entire available history to the analysis date",
"trailing 12 months to the analysis date",
"trailing 12 months to the analysis date"],
"filters": ["all channels", "all channels", "store channel only"],
"grain": ["customer", "customer", "customer"],
"owner": ["Vice president of retail", "CRM manager",
"Finance, retail economics"],
"decision_use": ["long-run brand narrative; not suitable for "
"period-over-period comparison",
"headline retention tracking; baseline for the "
"expansion review",
"economics of the physical footprint; store-level "
"go/no-go"],
"value_in_preview": [round(rate_a, 2), round(rate_b, 2),
round(rate_c, 2)]
})
metric_dictionary
Expected output: a table with three rows, one per definition, matching Table 3.6.
The dictionary does not merely record the past computation; it changes future behavior. Any analyst — or any AI assistant supplied with this table as context — asked for “the repeat purchase rate” must now confront the fact that three exist, and must choose one by name. Ambiguity has been converted into a menu.
3.10.5 One More Verification: Hand-Check the Middle Number
The final planned check is a hand count of Definition B, the number most likely to become the headline. Customers with at least one order between July 1, 2025 and June 30, 2026: C01, C03, C04, C06, C07, C08, and C09 — seven customers. Of these, customers with at least two orders in the window: C01 (September 2025 and February 2026), C04 (August, December, May), and C06 (two January orders) — three customers. Three divided by seven is approximately 0.43, matching the computed value. As in Chapter 2, a single hand-checked figure does not prove the code correct, but it catches reversed filters, wrong comparison operators, and off-by-one window boundaries — and with ten customers it costs one minute, which is precisely why this guide’s labs stay small enough to count.
3.11 Marketing Interpretation and Managerial Insight
The previous section produced three verified numbers and a dictionary that distinguishes them. This section asks what StyleCraft should do with them before the October 15 review, which is where measurement work either earns its keep or remains a technical exercise.
A weak response to the meeting would be to average the three figures, or to let the loudest stakeholder’s number stand, or to declare the discrepancy a “data issue” and commission a systems project. Each move mistakes a definitional question for an arithmetic or technical one. The numbers do not disagree; the definitions do, and definitions are chosen, not fixed.
A stronger response reasons from the decision, in the manner of Chapter 2. The live decision is the store expansion, and the decision-relevant question is whether recently acquired customers are forming a repurchase habit now. The lifetime definition is nearly useless for this: it is dominated by the accumulated history of the oldest, urban-acquired customers, it can only rise slowly or fall slowly, and it will register a change in current behavior years late. It is not wrong; it is unresponsive. The trailing-twelve-month definition is built for the question — it holds the window fixed, so movement in the number reflects movement in behavior — and it is the natural headline metric, with one caveat the dictionary should record: customers acquired late in the window have had little time to repurchase, a mechanical depressant that the same-age cohort comparison promised in Chapter 2 is designed to remove. The store-only definition, finally, answers finance’s narrower and legitimate question about the economics of the physical footprint, and should be reported alongside the headline rather than suppressed — labeled, so that a 20 and a 43 can no longer share a slide unexplained.
The managerial recommendation that follows is modest and concrete: adopt repeat_rate_t12m as StyleCraft’s headline definition, assign the CRM manager as its owner, report repeat_rate_store_t12m beside it in expansion reviews, retire the lifetime figure from decision documents, and publish all three entries in the data dictionary with their owners and decision uses attached. One further recommendation belongs with them, because Section 3.1 established that the chosen definition will also become a CRM performance target. The dictionary entry should carry the gaming risk explicitly — enrollment tactics that manufacture second purchases will raise the measured rate without creating loyalty — and the review should pair the headline rate with at least one metric that such tactics would not move.
Notice what the recommendation does not claim. It does not claim the headline number is good or bad, and it does not resolve the expansion question. Measurement work rarely answers the business question by itself. What it does is subtler and, over time, more valuable: it ensures that when the organization argues, it argues about the business rather than about what its own words mean.
3.12 Business Analytics in Practice
The previous section resolved a definitional dispute inside a fictional retailer. This section turns from the fictional case to real organizational practice, and to what the same dispute costs the organizations that live it: where metric definitions are regulated, where they are contested between departments, and where a single parameter in an advertising platform quietly reallocates a budget. The three situations differ enormously in scale. The mechanism is the one this chapter has been describing throughout.
3.12.1 “Active Users,” in Public
Consumer technology companies are valued substantially on user counts, which means that a phrase like monthly active users is not internal vocabulary but a reported figure investors act on. It is also, like every metric in this chapter, a definition rather than a fact — and the securities regulator treats it that way.
In January 2020 the U.S. Securities and Exchange Commission issued interpretive guidance on the use of key performance indicators and metrics in management’s discussion and analysis. A company presenting a metric, the Commission said, should ordinarily accompany it with a clear definition of the metric and how it is calculated, a statement of why the metric is useful to investors, and a statement of how management uses it in managing the business (U.S. Securities and Exchange Commission, 2020). More striking, for this chapter’s purposes, is what the guidance asks for when a definition changes. If a company alters the method by which a metric is calculated or presented, it should consider disclosing, to the extent material, the differences from prior periods, the reasons for the change, the effects of the change on both current and previously reported amounts, and any other methodological differences a reader would need in order to understand performance (U.S. Securities and Exchange Commission, 2020).
Read against Section 3.5.1, that is a regulator enforcing the same underlying discipline: define how the metric is calculated, explain why it matters and how management uses it, and disclose material changes in definition or presentation. The requirement exists because the alternative has been observed repeatedly, and the platform companies’ own filings are unusually candid about it.
Facebook’s quarterly filings carried a standing section titled “Limitations of Key Metrics and Other Data,” disclosing that duplicate accounts may have represented approximately 10 percent of its worldwide monthly active users, and false accounts approximately 3 to 4 percent (Facebook, Inc., 2018). Those are not rounding errors; they are the numerator’s known impurities, published because the metric could not be honestly read without them. Twitter’s filings disclosed a different kind of gap. Its user counts included people reached through applications that “automatically contact our servers for regular updates with no discernible user-initiated action involved,” a population the company quantified at fewer than 8.5 percent of monthly active users as of December 31, 2017 (Twitter, Inc., 2018). A reader who takes active user to mean a person who chose to open the application is not reading the same metric the company is reporting.
Neither case is an arithmetic mistake. Together they show two ways a user-count numerator can diverge from its ordinary-language meaning: known impurities that must be disclosed, and a technical inclusion rule that counts activity no person initiated. The practice lesson is that the four-element discipline is not a classroom formality. In public markets it is a disclosure obligation, and the specific thing regulators worry about is the situation this chapter opened with — one metric name denoting different quantities to different readers, or in different periods.
3.12.2 The Acquisition-Cost Dispute, and What Firms Build to End It
Inside companies the same problem arrives without a regulator. The most reliably contested marketing metric is customer acquisition cost, and the dispute follows a pattern recognizable from Section 3.1. Marketing computes it as campaign spend divided by new customers attributed to campaigns. Finance computes it as total sales and marketing expense — salaries, agency retainers, tooling, and all — divided by every new customer, attributed or not. Marketing’s number is usually smaller — sometimes substantially so — and neither team has necessarily made an error. They have chosen different numerators, different denominators, and frequently different windows, because they are answering different questions: marketing is asking what a campaign returns, finance is asking what growth costs the company.
The dispute is survivable once. It becomes expensive when it recurs every quarter, because each recurrence spends senior meeting time re-litigating vocabulary. Two organizational responses are designed to prevent the dispute from recurring, and both are a data dictionary at institutional scale.
The first is technical. A semantic or metrics layer places the definition of each metric in one version-controlled location between the data warehouse and every tool that queries it, so that a dashboard, a notebook, and a spreadsheet all resolve “customer acquisition cost” to the same expression. The tooling in this space is explicit about the problem it exists to solve: multiple analysts each writing their own query for the same metric produces confusion, inconsistency, and an ongoing data-management burden (dbt Labs, n.d.). The layer does not decide what customer acquisition cost should mean. It makes the chosen meaning the path of least resistance, which in practice is most of the battle.
The second response is governance. Firms establish data governance councils, or appoint data stewards, with explicit authority over definitions. Khatri and Brown (2010) frame governance as a matter of decision rights rather than rules: the design question is who decides what, across domains including data principles, data quality, and metadata — and metadata is precisely where “what does this column mean” formally lives. A metric council does on a standing basis what the CFO did once in the opening case: it names an owner for each contested metric, records the definition, and adjudicates proposed changes.
The practice lesson is a distinction worth carrying into a first job. A data dictionary maintained by one conscientious analyst is a personal habit, and it leaves when that analyst does. A data dictionary with named owners, a review process, and a system that enforces it is an organizational capability. Only the second one stops the meeting from happening again next quarter.
3.12.3 The Attribution Window Is a Budget Decision
The third example is the one most likely to appear in a first analyst job, because it arrives disguised as a settings page. Advertising platforms count a conversion as caused by an ad if the conversion occurs within a stated period after the interaction. That period is the conversion, or attribution, window, and it is a parameter the advertiser sets.
Google Ads documents the arithmetic plainly. It sets a default 30-day click-through window, adjustable between 1 and 90 days depending on the conversion source, and a default one-day view-through window; for web conversions the engaged-view default is three days, while some app conversion types use shorter defaults (Google, n.d.). The consequence is stated without euphemism: a shorter conversion window reduces the number of conversions the account records for that conversion action, and conversions occurring after the window closes simply do not appear in reports (Google, n.d.). Nothing about the customers changes. The same people buy the same products on the same days. What changes is the window in the metric’s definition — the third of the four elements from Section 3.5.1.
The consequence is budgetary, because reported conversions drive reported cost per acquisition and return on ad spend, and those figures drive allocation. A campaign whose customers deliberate for three weeks looks efficient under a 30-day window and wasteful under a 7-day one. If two channels are compared under different windows — which happens easily, since every platform ships its own defaults — the comparison is not close to fair, and the budget moves anyway. Attribution has a serious research literature precisely because these rules determine credit and therefore money; Berman (2018) shows that attribution rules do not merely describe advertising outcomes but change how advertisers and publishers behave.
The practice lesson is that some of the most consequential measurement decisions an analyst will ever make are exposed as configuration. They do not look like decisions, which is exactly why they are made carelessly. Recording the window alongside every attributed figure, and refusing to compare channels measured on different windows, is a small habit with a large budget attached.
3.12.4 In Your First Analyst Job
Across these three situations, one failure recurs, and it is not computational. A name outlives the definition it was given. The regulator’s concern, the finance dispute, and the attribution window are versions of the same event: a phrase becomes load-bearing before anyone writes down what it means.
In your first analyst job you will inherit metric names. A few will be documented; most will not be. The productive first move is small and unglamorous. For any metric you are asked to produce, find its numerator, its denominator, its window, and its filters — and if nobody in the organization can state all four, you have just discovered the most valuable thing you will do that month. Write them down where the people who disagree can see them and object.
There is a reason to do this even when no one asks. In every organization, someone ends up being the person who knows what the numbers mean, and that person gets consulted before decisions are made rather than after. Whoever controls the definitions controls the conversation. The way to control them is not to guard them; it is to write them down.
3.13 Ethics, Privacy, and Responsible Measurement
So far this chapter has treated measurement as a matter of precision. This section treats it as a matter of responsibility, extending the discussions in Sections 1.13 and 2.12 from the use of data and the framing of questions to the design of measures themselves.
The first issue is that measurement allocates attention. What an organization measures, it manages; what it leaves unmeasured tends to become invisible in decisions. StyleCraft’s tables measure purchases, clicks, and enrollments; they do not measure customer trust, employee strain in the new stores, or the experience of the customer who receives no offers because no model scores her as valuable. The analyst cannot measure everything, but the analyst can say out loud what a measurement scheme omits — the same representational duty that Section 2.12 assigned to problem framing.
The second issue is that proxies encode assumptions, and flawed proxies can systematically disadvantage groups of people. The healthcare-cost example of Section 3.6.1 is the canonical demonstration (Obermeyer et al., 2019), and the mechanism transfers directly to marketing: if “customer value” is operationalized as historical spend, then customers the company historically underserved — the markets where it barely marketed, the channels it launched late — will measure as low-value, and a targeting rule built on the proxy will underserve them again. The StyleCraft data contains a deliberate instance of this trap: the newest stores’ customers look unresponsive partly because the stores are new and were under-marketed during ramp-up, and a naive measure of market potential would recommend abandoning them (Barocas & Selbst, 2016). Chapters 6 and 9 return to this artifact; the defense begins here, with the habit of asking what a proxy assumes.
The third issue is privacy as a measurement design choice. Every column is a decision to record something about a person, and granularity is part of the decision: StyleCraft stores age_band rather than birthdate and permits gender to be Undisclosed — small design choices that trade analytical precision for reduced exposure, in the spirit of collecting the minimum the purpose requires (Martin & Murphy, 2017). The data dictionary is where such choices become visible and reviewable: a dictionary that records what is collected, from where, and why is also, quietly, a privacy inventory. Furthermore, the same restraint applies to the analyst’s tools: pasting customer-level data into an external AI assistant is a measurement-custody decision, not merely a convenience, and Section 1.13’s warning applies with full force.
Concept
Responsible Measurement
Responsible measurement is the practice of designing and documenting measures with awareness of what they omit, what their proxies assume, whom their errors would disadvantage, and what their collection costs the people being measured. It extends responsible analytics (Section 1.13) and responsible framing (Section 2.12) to the level of the variable itself.
Source: Adapted from Obermeyer et al. (2019), Barocas and Selbst (2016), and Martin and Murphy (2017).
3.14 Chapter Summary
This chapter examined the measurement foundations beneath every analysis in this guide. The main point is that a number is a claim: every reported figure presupposes a unit of analysis, an operational definition, a time window, and filters, and when these are left unstated, one metric name can honestly denote several quantities — the situation the StyleCraft meeting demonstrated with three repeat purchase rates of 60, 43, and 20 percent.
The chapter built the vocabulary for stating the claim precisely. Measurement translates concepts into columns through operational definitions. The grain of a table and the unit of analysis of a claim are declared separately and usually, but not necessarily, coincide; a data family contains fact tables recording measures and dimension tables supplying attributes, and moving between grains changes the claim, with the ecological fallacy waiting for analysts who forget. Variables carry different kinds of information — nominal, ordinal, interval, ratio — and the level of measurement, which stored data types do not record under any pandas version, governs permissible summaries, encodings, and charts. One business concept can appear as a metric, a KPI, a dimension, or a feature, and a ratio metric is defined only when its numerator, denominator, window, and filters are written down. Measures can fail by invalidity, unreliability, or poor data quality, and proxies deserve particular scrutiny. The chapter’s central instrument, the data dictionary, records all of this — grains, columns, and metric definitions with their owners and decision uses — so that a team’s data can mean the same thing to everyone, including the AI assistants the team supervises.
The lab reconstructed the three-number dispute from eighteen visible rows, reconciled every stored type against its intended measurement level, verified each figure by hand, and resolved the dispute by documentation rather than recomputation. The chapter then stepped outside StyleCraft to see the same mechanism at other scales: a securities regulator requiring companies to define their metrics and disclose definitional changes, a marketing-versus-finance dispute over acquisition cost that firms answer with semantic layers and governance councils, and an advertising conversion window that moves budget without changing a single customer’s behavior.
Looking ahead, the dictionary describes the data as it should be; the files as they arrive are another matter. The next chapter opens StyleCraft’s raw transaction data — with its missing values, duplicates, outliers, impossible dates, and inconsistent labels — and develops the discipline of data preparation and exploratory analysis: finding the defects Table 3.4 named, remedying them defensibly, and verifying an AI assistant’s cleaning code before trusting a single row it touched.
3.15 Exercises for Practice and Homework
The following exercises practice the chapter’s main habits: name the unit of analysis, classify the variable, assign the role, define the metric completely, judge validity and quality, and document the result. They are organized into three groups. Core chapter practice is the required path and should be completed by every student. In-class activities are designed for discussion. Extensions are optional and go beyond the required material. Each exercise also carries its assignment label (required practice, in-class discussion, homework submission, or optional) so that instructors can assign selectively.
3.15.1 Core Chapter Practice
Exercise 3.1 Concept Check (Required Practice)
- Explain the difference between a concept and an operational definition, using “active customer” as the example.
- What is the grain of a table, and why does dimensional modeling treat declaring it as the first design decision?
- How does the grain of a table differ from the unit of analysis of a claim, and give one situation in which the two come apart.
- What distinguishes a fact table from a dimension table, and why is StyleCraft’s campaigns table an awkward case for that distinction?
- State the four levels of measurement and give one StyleCraft column at each level that is not used as an example in Table 3.2.
- Why can one field serve as a dimension in a dashboard and as a feature in a model? Give an example of each use for acquisition_channel.
- What four elements define a ratio metric completely, and which of the four did the three StyleCraft teams disagree about?
- Explain why reliability is necessary but not sufficient for validity, with a marketing example.
Exercise 3.2 Identify the Unit of Analysis (Required Practice)
For each question or dataset, name the unit of analysis of the claim, the grain of the table you would start from, and which StyleCraft base or derived table that is. Where the two differ, say what aggregation closes the gap.
- What share of customers acquired through TikTok place a second order within 90 days?
- What is the average discount depth on occasionwear lines?
- Which store had the largest year-over-year revenue growth?
- Did daily revenue accelerate after the Beverly Hills opening?
- Which campaigns produced the lowest cost per click?
- Is average order value higher for app orders than for online orders?
- A file in which one row records one customer’s recency, frequency, and total spend.
- A file in which one row records one day’s total revenue and marketing spend.
Exercise 3.3 Classify the Variables (Required Practice)
For each StyleCraft column, state the level of measurement (nominal, ordinal, interval, or ratio), the data type you would expect pandas to report on first load, and one operation that would be arithmetically possible but conceptually impermissible.
- store_name
- loyalty_tier
- order_date
- quantity
- customer_id
- age_band
- discount_pct
- is_occasionwear
Exercise 3.4 Metric, KPI, Dimension, or Feature? (Required Practice)
Classify each item in its described use as a metric, a KPI, a dimension, or a feature, and justify the classification in one sentence.
- Average order value, computed for a one-time comparison of store types.
- Repeat purchase rate, with a 45 percent target, owned by the CRM manager, reviewed monthly by the executive team.
- store_type, used to break out revenue in a Tableau dashboard.
- Days since last purchase, computed per customer as an input to the Chapter 9 churn model.
- Email opt-in rate, reported once in a memo about signup-flow changes.
- generation (Gen Z versus Gen Y), used to filter a campaign performance report.
- Discount share of a customer’s purchases, standardized and fed to a clustering algorithm.
- Return on ad spend, on the CMO’s quarterly scorecard with a target of 4.0.
Exercise 3.5 Define the Metric Precisely (Homework Submission)
Each phrase below circulates at StyleCraft without a written definition. For each, write a complete metric definition — numerator, denominator, window, filters, and grain — and then write a second, different but equally defensible definition. Conclude each pair with one sentence on which definition you would recommend, for what decision, and who should own it.
- “Active customer.”
- “Conversion rate” for the mobile app.
- “Average discount.”
- “Customer growth” for the quarterly board deck.
- “Loyalty engagement.”
Exercise 3.6 Hands-On Colab Practice (Homework Submission)
- Open a new Google Colab notebook and reproduce Lab 3.1. Record the pandas version your environment reports and state whether your text columns arrived as object or str.
- Add a Backstage-tier customer to the preview and rerun Code 3.2. Verify that max() and the “Insider or above” count respond as predicted.
- Compute tenure_days for each customer as the days between signup_date and the analysis date (June 30, 2026). State the level of measurement of signup_date and of tenure_days, and explain why they differ.
- Recompute Definition A with the denominator reindexed against the full customers table, so that customers with zero orders count as non-repeaters. Explain in two sentences why this preview gives the same answer and why a real CRM would not.
- Write a fourth repeat-rate definition: trailing 12 months, all channels, but restricted to customers who signed up before the window opened. Predict whether it will be higher or lower than Definition B, compute it, and explain the result in two sentences.
- Add your fourth definition to the metric_dictionary frame with every element completed, including an owner and the decision it would inform.
- Report one verification check you performed and one way this ten-customer preview could mislead if treated as representative.
Exercise 3.7 AI-Assisted Practice (Homework Submission)
- Paste the customers preview from Lab 3.1 into an AI assistant and use the prompt from the AI in Practice box in Section 3.9 to draft dictionary entries for all six columns.
- Audit the draft: identify at least one allowed-values range the assistant inferred from the sample rather than from business rules, and at least one known issue it could not have known.
- Ask the assistant to define “repeat purchase rate” with no further context, and compare its answer with the three definitions in Table 3.6. Which did it choose, and did it state that it was choosing?
- Document the exchange using the AI-use documentation template in Appendix D (introduced as Table 1.6).
Exercise 3.8 Build the Data Dictionary (Homework Submission)
Using the format of Table 3.5, write complete dictionary entries for all seven columns of the StyleCraft products table (Table 3.1 lists the table; the schema appears in the companion repository). For each column, include a plausible known issue. Then add one metric entry, in the format of Table 3.6 including owner and decision use, for “average selling price,” and explain in two sentences how it differs from the unit_price column.
Exercise 3.9 Managerial Memo Exercise (Homework Submission)
Write a memo of 250–350 words from the analytics team to the StyleCraft CMO and CFO, dated before the October 15 expansion review, proposing the official definition of repeat purchase rate. The memo must state the decision the metric will inform, the recommended definition with all four elements explicit, the two rejected definitions and the legitimate uses each retains, the owner and review cadence, one validity limitation of the metric as a proxy for loyalty, and one anticipated gaming behavior with a countermeasure. Recommended structure: decision context, recommended definition, treatment of alternatives, ownership, limitations and risks.
3.15.2 In-Class Activities
Exercise 3.10 Find the Flaw in the Measurement (In-Class Discussion)
- The averaged identifier. An AI-generated summary of the transactions table includes a row reporting the mean of customer_id. What went wrong, and at which stage of this chapter’s checks would it have been caught?
- The alphabetical tiers. A bar chart shows customer counts by loyalty_tier in the order Backstage, Insider, None, VIP, and a stakeholder concludes the program “peaks in the middle.” Diagnose the error.
- The generous window. A team reports that “78 percent of customers are repeat buyers” using the lifetime definition, in a deck about the current quarter’s retention. Is the number wrong? What is it, precisely?
- The proxy promotion. To raise “loyalty,” measured by tier enrollment, stores begin auto-enrolling every checkout. Enrollment doubles. Has loyalty doubled? Connect your answer to Sections 2.12 and 3.6.
- The grain jump. A slide states: “Stores with higher average order value have lower repeat rates, so we should discourage large baskets.” Identify the fallacy and restate what the evidence supports.
- The two nulls. An analyst drops all rows with missing campaign_id before computing campaign ROAS. What has the analyst assumed about the nulls, and what is the alternative?
- The moving window. An analyst filters orders with a one-sided condition, keeping everything on or after the window start. The dashboard is scheduled to refresh weekly. What happens to the reported rate over the following three months, and why is the trend an artifact?
Exercise 3.11 Ethics of Measurement Mini-Cases (In-Class Discussion)
For each case, identify the measurement issue, the stakeholders affected, and what a responsible analyst should do instead.
- The convenient proxy. A “customer value” score built on historical spend is used to allocate service priority. The lowest scores cluster in the markets where StyleCraft opened most recently and marketed least.
- The optional field. To improve targeting, a proposal would make age and gender required at signup rather than optional. Conversion on the signup form is expected to drop, and the fields would be stored at full precision.
- The unmeasured cost. The expansion review measures store revenue, cost, and repeat rate, but nothing about the staff turnover in the new stores, which the retail team privately reports is severe.
3.15.3 Extensions
Exercise 3.12 Reflection Questions (Optional)
Finally, the following questions are intended to be thought-provoking rather than graded.
- Think of a metric that matters in an organization you know. Can you state its numerator, denominator, window, and filters? If not, who could?
- Have you ever seen a meeting stall over two versions of “the same” number? In this chapter’s terms, what was actually in dispute?
- Which marketing concept do you believe is measured worst by the proxies commonly used for it, and what would a better measure require?
- What information about you, as a customer, do you suspect is recorded at finer granularity than the purpose requires?
- If a data dictionary prevents disputes, why do so few organizations maintain one? What would make the habit stick?
3.16 Glossary of Terms
This glossary includes only the terms introduced in this chapter. Each definition is tied to the sources used in the chapter rather than added for decoration.
Data dictionary. A shared, maintained document recording, for each table, its grain; for each column, its definition, type, level of measurement, allowed values, source, and known issues; and, in the extended form used in this guide, for each named metric, its numerator, denominator, window, filters, grain, owner, and the decision it informs (adapted from Kimball & Ross, 2013).
Data quality. The degree to which data is fit for its intended uses, assessed along dimensions including accuracy, completeness, consistency, uniqueness, timeliness, and conformity (course synthesis informed by Wang & Strong, 1996; Redman, 1998).
Dimension. An attribute used to slice, group, or filter metrics in descriptive analysis and dashboards, typically drawn from a dimension table (Kimball & Ross, 2013).
Dimension table. A table whose rows describe entities — customers, products, stores — and whose columns supply the attributes by which facts are sliced, grouped, and filtered (Kimball & Ross, 2013).
Ecological fallacy. The error of inferring individual-level relationships from group-level data (Robinson, 1950).
Fact table. A table whose rows record events or measurements at a declared grain, typically carrying quantitative measures, many of which can be aggregated to construct metrics; StyleCraft’s transactions table is its primary sales fact table (Kimball & Ross, 2013).
Feature. A variable prepared as an input to a predictive model, often engineered from raw columns at the model’s unit of analysis (Provost & Fawcett, 2013; Domingos, 2012).
Grain. What one row of a table represents. Grain is a property of a table and is declared when the table is designed; it usually, but not necessarily, coincides with the unit of analysis of the claims computed from it (Kimball & Ross, 2013).
Key performance indicator (KPI). A metric elevated to guide action: connected to strategy, attached to a target, assigned an owner, and reviewed on a cadence (Parmenter, 2015).
Level of measurement. The classification of a variable as nominal, ordinal, interval, or ratio, which governs the mathematical operations and summaries the variable supports (Stevens, 1946).
Measurement. The assignment of numbers, labels, or categories to observations according to explicit rules (Stevens, 1946).
Metric. A quantity computed from data by an explicit rule for description or comparison; a ratio metric is fully specified by its numerator, denominator, window, and filters (adapted from Farris et al., 2010).
Operational definition. The specific written rule by which a concept is turned into a recorded or computed value, including population, window, and filters (adapted from Churchill, 1979; Carmines & Zeller, 1979).
Proxy measure. A measure adopted to stand in for a concept that cannot be observed directly; proxies import assumptions that can fail silently or inequitably (Obermeyer et al., 2019).
Reliability. The degree to which a measure produces consistent results under repeated or equivalent measurement (Carmines & Zeller, 1979).
Responsible measurement. The practice of designing and documenting measures with awareness of what they omit, what their proxies assume, whom their errors would disadvantage, and what their collection costs the people measured (adapted from Obermeyer et al., 2019; Barocas & Selbst, 2016; Martin & Murphy, 2017).
Stored data type. The type a software system uses to hold a column’s values — integer, decimal, Boolean, datetime, or text. The stored type records how a value is kept, not what level of measurement it carries, and its name may change between software versions (pandas development team, n.d.).
Unit of analysis. The entity about which an analysis makes its claim, which the analytic specification requires to be named (Section 2.5). Distinct from, though usually aligned with, the grain of the table the claim is computed from (Kimball & Ross, 2013; Robinson, 1950).
Validity. The degree to which a measure captures the concept it is intended to capture (Carmines & Zeller, 1979; Churchill, 1979).
Variable. Any characteristic recorded for each unit in a dataset; a column considered as a carrier of information rather than as storage (Stevens, 1946).
3.17 Further Readings
Students who want additional background may begin with the following readings. Measurement-focused sources are listed first because this chapter approaches analytics from the measurement side.
- Stevens (1946) for the original statement of the four levels of measurement, still short and readable.
- Churchill (1979) for the classic paradigm for developing marketing measures, and for the argument that poor translation of constructs, not poor statistics, is the usual culprit.
- Kimball and Ross (2013) for grain, fact tables, and dimensions — the data-modeling vocabulary used by analytics teams everywhere.
- Robinson (1950) for the ecological fallacy in its original form.
- Wang and Strong (1996) for the consumer-centered view of data quality, and why “good data” is always relative to a use.
- Obermeyer et al. (2019) for the consequences of a flawed proxy deployed at scale.
3.18 References
Barocas, S., & Selbst, A. D. (2016). Big data’s disparate impact. California Law Review, 104(3), 671–732. https://doi.org/10.15779/Z38BG31
Berman, R. (2018). Beyond the last touch: Attribution in online advertising. Marketing Science, 37(5), 771–792. https://doi.org/10.1287/mksc.2018.1104
Campbell, D. T. (1979). Assessing the impact of planned social change. Evaluation and Program Planning, 2(1), 67–90. https://doi.org/10.1016/0149-7189(79)90048-X
Carmines, E. G., & Zeller, R. A. (1979). Reliability and validity assessment. Sage.
Churchill, G. A., Jr. (1979). A paradigm for developing better measures of marketing constructs. Journal of Marketing Research, 16(1), 64–73. https://doi.org/10.1177/002224377901600110
dbt Labs. (n.d.). About MetricFlow. dbt Developer Hub. Retrieved July 27, 2026, from https://docs.getdbt.com/docs/build/about-metricflow
Domingos, P. (2012). A few useful things to know about machine learning. Communications of the ACM, 55(10), 78–87. https://doi.org/10.1145/2347736.2347755
Facebook, Inc. (2018). Quarterly report (Form 10-Q) for the quarterly period ended March 31, 2018. U.S. Securities and Exchange Commission. https://www.sec.gov/Archives/edgar/data/1326801/000132680118000032/fb-03312018x10q.htm
Farris, P. W., Bendle, N. T., Pfeifer, P. E., & Reibstein, D. J. (2010). Marketing metrics: The definitive guide to measuring marketing performance (2nd ed.). Pearson Education.
Google. (n.d.). About conversion windows. Google Ads Help. Retrieved July 27, 2026, from https://support.google.com/google-ads/answer/3123169
Khatri, V., & Brown, C. V. (2010). Designing data governance. Communications of the ACM, 53(1), 148–152. https://doi.org/10.1145/1629175.1629210
Kimball, R., & Ross, M. (2013). The data warehouse toolkit: The definitive guide to dimensional modeling (3rd ed.). Wiley.
Martin, K. D., & Murphy, P. E. (2017). The role of data privacy in marketing. Journal of the Academy of Marketing Science, 45, 135–155. https://doi.org/10.1007/s11747-016-0495-4
Obermeyer, Z., Powers, B., Vogeli, C., & Mullainathan, S. (2019). Dissecting racial bias in an algorithm used to manage the health of populations. Science, 366(6464), 447–453. https://doi.org/10.1126/science.aax2342
pandas development team. (n.d.). Migration guide for the new string data type (pandas 3.0). pandas documentation. Retrieved July 27, 2026, from https://pandas.pydata.org/docs/user_guide/migration-3-strings.html
Parmenter, D. (2015). Key performance indicators: Developing, implementing, and using winning KPIs (3rd ed.). Wiley.
Provost, F., & Fawcett, T. (2013). Data science and its relationship to big data and data-driven decision making. Big Data, 1(1), 51–59. https://doi.org/10.1089/big.2013.1508
Redman, T. C. (1998). The impact of poor data quality on the typical enterprise. Communications of the ACM, 41(2), 79–82. https://doi.org/10.1145/269012.269025
Robinson, W. S. (1950). Ecological correlations and the behavior of individuals. American Sociological Review, 15(3), 351–357. https://doi.org/10.2307/2087176
Stevens, S. S. (1946). On the theory of scales of measurement. Science, 103(2684), 677–680. https://doi.org/10.1126/science.103.2684.677
Strathern, M. (1997). “Improving ratings”: Audit in the British university system. European Review, 5(3), 305–321. https://doi.org/10.1002/(SICI)1234-981X(199707)5:3<305::AID-EURO184>3.0.CO;2-4
Twitter, Inc. (2018). Annual report (Form 10-K) for the fiscal year ended December 31, 2017. U.S. Securities and Exchange Commission. https://www.sec.gov/Archives/edgar/data/1418091/000156459018003046/twtr-10k_20171231.htm
U.S. Securities and Exchange Commission. (2020). Commission guidance on management’s discussion and analysis of financial condition and results of operations (Release Nos. 33-10751; 34-88094). https://www.sec.gov/rules/interp/2020/33-10751.pdf
Velleman, P. F., & Wilkinson, L. (1993). Nominal, ordinal, interval, and ratio typologies are misleading. The American Statistician, 47(1), 65–72. https://doi.org/10.1080/00031305.1993.10475938
Wang, R. Y., & Strong, D. M. (1996). Beyond accuracy: What data quality means to data consumers. Journal of Management Information Systems, 12(4), 5–33. https://doi.org/10.1080/07421222.1996.11518099