OLAP operations: roll-up, drill-down, slice and dice
Analysts look at the same data from different angles. Picture sales as a cube with three dimensions (time, product and geography) and one measure in every cell: revenue. Each dimension has levels:
- Time: year → quarter → month → day
- Product: category → brand → product
- Geography: country → state → city
The classic OLAP operations move around that cube.
Roll-up
Summarise to a higher level: day → week, city → state.
| Day | Revenue |
|---|---|
| Monday | ₹10,000 |
| Tuesday | ₹12,000 |
| Wednesday | ₹8,000 |
| Thursday | ₹15,000 |
| Friday | ₹20,000 |
Rolled up to the week: ₹10,000 + ₹12,000 + ₹8,000 + ₹15,000 + ₹20,000 = ₹65,000.
SQL can produce several levels at once with ROLLUP, which adds subtotal rows for each level plus a grand total:
Drill-down
The opposite: go from a summary to finer detail, year → quarter → month, or country → state → city. If sales in India fell this year, a manager drills down to states, then cities, to find where.
Slice
Fix one dimension to a single value, here only 2026:
Dice
Pick a sub-cube across several dimensions:
Pivot
Rotate the view: swap what's in rows and what's in columns. The data doesn't change; only the layout does.