liveBook · Manning

Granularity

As explained in Everyday Data Visualization

Grain is the level of detail defined by what one row in a data table represents.

Granularity, or grain, is the level of detail defined by what one row represents. A row might describe one transaction, one day of activity, one account snapshot, one fruit, or one hotel reservation. Knowing the grain prevents accidental mixing of detailed and aggregated data—and helps catch duplicates before they distort totals. section 3.5.1 section 8.1

Table 3.1 A table of data I hypothetically collected about how tasty individual fruits have been recently (view table figure)

Fruit ID

Fruit type

Taste score

Date eaten

1

Apples

60

Jun 2, 2022

2

Kiwis

70

Jul 9, 2022

3

Mangos

100

Aug 15, 2022

4

Oranges

50

Aug 30, 2022

5

Fuyu Persimmons

50

Sep 17, 2022

6

Peaches + Nectarines

100

Sep 20, 2022

7

Peaches + Nectarines

95

Sep 23, 2022

8

Bananas

80

Sep 24, 2022

9

Bananas

75

Sep 25, 2022

10

Mangos

100

Sep 25, 2022

11

Fuyu Persimmons

100

Oct 3, 2022

The fruit table makes grain visible: each row records one fruit observation, with dimensions such as fruit type and date and a measurable taste score. section 3.5.1

Use grain as a quick diagnostic when reading, joining, or aggregating a table:

  • Name the row meaning before interpreting its columns or building a visualization. section 3.5.1 section 3.6
  • Distinguish detailed rows from summaries: transaction-level data can be aggregated by day, while daily totals cannot automatically restore individual transactions. section 3.5.1 section 3.6
  • Treat tables with different grains differently, especially when joining or calculating totals; a duplicated row can create serious errors. section 3.5.1

One fruit table, two grains

The detailed fruit table has one row per fruit. The aggregated table behind the bar charts has one row per fruit type and a summarized taste score. Both are valid, but they answer different questions because their grains differ. A hotel reservation table similarly uses one row per reservation, with stay duration, dates, guests, room type, and property. section 3.5.1 section 8.1

How Everyday Data Visualization covers it

How deep it goes
Explains grain through banking, fruit, and reservation examples, then stops short of detailed join or aggregation procedures.
Examples
Uses banking transactions, daily summaries, account snapshots, fruit observations, fruit-type scores, and hotel reservations.
What it assumes
Assumes tabular data with rows, columns, dimensions, and measures, while defining grain through concrete examples.
What you can do after
Evaluate/understand what each row represents before aggregating data or trusting calculated totals.
How it connects
Connects table grain to dimensions, measures, aggregation, tabular data, visualization, and data storage.

Also explained in

Compare how 8 books explain granularity →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Everyday Data Visualization. The section links point to the parts of the book it draws on.