A pivot table is the spreadsheet version of grouping and totalling, the same idea as GROUP BY in SQL.
It exists because summary questions come up far more often than questions about single rows.
Most of what a manager asks for is a total, a count or an average broken down by something.
Building one starts with a clean table: one header row, one row per record, no blank rows and no merged cells.
You then place columns into four areas: rows, columns, values and filters.
The values area needs a calculation, usually a sum, though count, average, minimum and maximum are common too.
A filter limits the whole table, for example to one year, without deleting anything.
Totals for each row and column are added automatically, along with a grand total.
Grouping dates by month or quarter is usually one setting rather than a new column.
In some programs a pivot table must be refreshed by hand after the source data changes.
Count and sum are easy to confuse: counting sales gives the number of orders, while summing gives revenue.
Blank cells or numbers stored as text in the value column can quietly change the totals.
A pivot table is the fastest way to answer a breakdown question that is asked once.
When the same breakdown is needed every week, the steps are usually moved into SQL or code.
The same idea appears in pandas later in this module, where it is called groupby or pivot_table.