What Does One Row Represent?
8 min read
Lesson objectives
- Distinguish the unit of observation from the grain of each source.
- Check keys and quantify the effect of a join on counts and totals.
- Write a field definition that explains timing and missing values.
Please sign in to use all the tools
Once you sign in, the reading tools are yours: larger or smaller text, typeface, line spacing, focus mode, highlighting and bold, and notes saved to your account and gathered in My study.
Choose the thing to count
Look at a shop receipt. The number at the top identifies a purchase. Below it, each line describes an item. Someone who buys a mug and a notebook makes one purchase represented by two item lines. Counting purchases by counting lines would make the shop busier every time a customer bought more items. Even a simple count begins with a choice about what counts as one.
The unit of observation is the thing or event you are observing. A request is a useful unit if you want to study how long requests take. A handoff is more useful if you want to study how work passes from one employee to another. Data grain describes the smallest unit each row in a particular source represents. You may find one row per request in one table and five for the same request in a table that records five events. The question determines the unit you need. The way the source was built determines the grain it actually has.
A row in a daily totals table represents an office on one day. Add counts when visits belong to one office. Finding the longest wait needs finer records.
Identify the row
A key is a value or a set of values that identifies a row. A request number can serve as the key in a table with one row per request. If two branches use the same numbers, the key may be the branch code together with the request number. Check first for repeated numbers, then for repeated pairs. If number 24 appears in two branches, the branch tells you which request it denotes. If the pair appears twice, ask the custodian whether the source records two versions of a request or two events.
A staff ID or date is unlikely to identify a row just because it looks unique in a short extract. You need to know the rules under which the IDs are assigned. Ask the party responsible for the numbering when it starts over. If each year begins again at one, include the year in the key or find a stable identifier. A check on sample rows can expose a fault. Knowing the underlying process tells you what the key should be.
An event key distinguishes events that look alike. One staff member may leave two comments on the same request within a minute. If you use only the timestamp and staff ID, you might remove the second comment as a duplicate. An event ID solves this if the system assigns a fresh ID to each action. The request ID on the same table serves a different role. It refers back to the request and can appear many times without indicating an error.
Join two tables
Consider three requests. The first was registered, reviewed and closed. The second has one registration event. The third has no matching events in the extract. Joining the request table to the event table gives three results for the first and one for the second. A join that preserves all requests keeps a row for the third with blank event fields. You now have one row per matching event plus a row for each request without a recorded match. Say what a row represents before you count it.
A blank event field can leave the underlying status unresolved. Processing might not have started, or the event may have reached the second table after your extract was made. The data custodian can tell you how often the table refreshes. You can have missing matches in the other direction too. An event may refer to a request absent from your extract. Count those cases and inspect a few before doing the analysis. The events may use old identifiers, or the request extract may cover a shorter period.
Leave a usable data dictionary
- Data dictionary
A data dictionary records what fields represent. Start with the field name, its meaning in the business, its format or unit, the permitted values, the way a missing value is recorded, and the system that provides it. Take a field called processing start. If it captures the time a staff member pressed a button, say so. Someone may open a paper file earlier. A colleague can then tell what kind of wait the field supports.
Record who owns the definition and when it changed. If completion begins to require customer notice, use a consistent measure to compare periods.
| Grain | Key | Example |
|---|---|---|
| Request | Branch and request number | East 8 |
| Event | Event ID | East 8 opened |
Check the source using a small example
Two visitors can share a name, or one person can visit twice. Count visits by visit ID, find appointments by booking ID, and measure returning people with a stable person identifier.
Count distinct keys before and after joining, then count rows per key. Request counts may stay fixed while amounts multiply; check before summing charges.
Give a reviewer the results for a request with two events, one with none and one on a different time basis. Rerun the check after a source change.
Check your understanding
Lesson summary
The unit of observation is the thing you want to study, and grain describes what a row actually represents. Check possible keys against the process that assigns them and count the matches they produce before joining tables. When a request has many events, summarize those events to the request grain if you need fees or request counts. Record the fields’ meanings, units, missing values, and owners in a data dictionary. A colleague can then trace duplicated fees or conflicting timestamps to their source. The grain must suit the unit of observation, and source timestamps and their units must remain clear during reconciliation.