The vocabulary of OLAP (online analytical processing) sounds more mysterious than it is: slice, dice, drill down, roll up, pivot. We will work through all five on one small example, and by the end the words should map to things you already do in a spreadsheet pivot table.

The data is sales in lakh rupees for a stationery distributor, by city and by quarter:

CityQ1Q2
Chennai120150
Pune90110
Jaipur4055

Two things define a cube. The measure is the number you aggregate: here, sales. The dimensions are the ways you can cut it: city and quarter, and we could add product category as a third. With three dimensions it really is a cube; with five, the shape is hard to picture, but the operations are identical. A real cube would also hold a month level under quarter, a state level above city, and so on. Those layers are called hierarchies.

Roll up: fewer details, bigger totals

Rolling up climbs a hierarchy, or drops a dimension, and aggregates. Drop city and you get quarter totals: Q1 is 120 + 90 + 40 = 250, Q2 is 150 + 110 + 55 = 315. Drop quarter instead and you get city totals: Chennai 270, Pune 200, Jaipur 95. Drop both and you have the grand total of 565. Check that every route reaches 565; if they disagree, something is double counted or missing, which is a useful sanity test on any report.

Drill down: more detail, smaller pieces

Drilling down is the opposite move. Chennai’s Q2 of 150 looks strong. Drill from quarter to month and suppose it splits as 45, 52 and 53. Nothing alarming, just a steady build. Had it been 20, 30 and 100, you would be looking at a one-month event, perhaps a large institutional order, and the story would be different.

Drill-down only works if the hierarchy exists in the data model. If your fact table stores only quarter, you cannot get to months. Data should be loaded at the finest grain you will ever need, and rolled up from there, since you can always add up but you can never split what has been added.

Slice: fix one dimension

A slice holds one dimension at a single value and shows what remains. Slice on quarter equal to Q2: you see Chennai 150, Pune 110, Jaipur 55. It is a two-dimensional section of the cube, like cutting a loaf. In a BI tool, this is a filter or slicer control.

Dice: select a sub-cube

Dicing restricts several dimensions at once, each to a set of values. Chennai and Pune only, Q1 and Q2 both: four cells, 120, 150, 90 and 110, adding to 470. Where a slice fixes one value, a dice picks ranges or lists on more than one dimension, so you still have a cube, just a smaller one.

Pivot: rotate the view

Pivoting swaps which dimension runs across the columns and which down the rows. Above, cities are rows and quarters are columns. Pivot and quarters become rows, with a column each for Chennai, Pune and Jaipur. The numbers do not change; only the arrangement does, but a good arrangement can make a pattern jump out. Put the dimension with more members down the rows, since screens are taller than they are wide.

Why a cube, and not a query every time

Classic OLAP servers pre-calculate the totals, so rolling up is a lookup and not a scan of crores of rows. That made interactive exploration possible when hardware was slow. Today, columnar warehouses are fast enough that many teams compute aggregates on demand, and tools such as Power BI’s in-memory models or Tableau extracts give a cube-like feel without a separate cube server. The vocabulary stuck because the operations are how analysts think.

Pre-aggregation has a catch: the number of possible totals multiplies with each dimension and hierarchy level, so full pre-computation can balloon storage. Practical designs pre-compute the combinations people actually ask for.

The roll-up trap

Rolling up is only safe when the measure can be added. Sales rolls up by summing. But average order value, or customer counts, do not: if Chennai has 4,000 distinct customers in Q1 and 4,200 in Q2, the half-year figure is not 8,200, since many bought in both quarters. Rates must be recomputed from their numerators and denominators at the new level, not averaged. This is the commonest way for a cube-based report to show a wrong total with a straight face.

With that one caution, you now have the full vocabulary. If someone asks you to “drill into Jaipur” or “slice by Q2”, you know what is being asked, and which cells of the table they mean.

Figures and names in the examples are illustrative.

Leave a Reply

Trending