Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Preview

DA 3.3: OLAP: looking at data from every side

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

55 minutes

One question, ten reports

A made-up bakery chain has two regions, two products and two months of sales. The manager asks for sales by region. Then by product. Then by month. Then by region and month.

Writing a new report each time takes a day. There is a faster way: organise the data so any view is one click or one line away.

Key words

WordWhat it meansExample
OLAPOnline analytical processing: a way to organise data so you can view it from many sides quickly.Sales by region, then by month
CubeData arranged by several dimensions, with a measure in each cell.Region by product by month
DimensionA way to split the data.Region, product or month
MeasureThe number you add up or average.Sales amount
SliceFix one dimension to a single value and look at the rest.Only January
Drill downMove from a total to the detail inside it.From all regions to one region
Roll upMove from the detail to a total.From each month to the year
ScenarioA what-if picture of the future based on a change.What if cake prices rise?

The cells students fill in are left blank in this preview.

By the end of this lesson

Note

I can explain what OLAP does, use slice, drill down and roll up on a table of sales, and run a simple what-if scenario.

Starter: what you already know

Have a go

Starter: what you already know

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

Four things OLAP gives you

  1. Data from many sources. OLAP sits on top of blended data, so one view can use the till, the website and the stock list.
  2. Unlimited views. Change the dimension and you have a new report. No new program to write.
  3. Complex calculations. Totals, running totals and shares of the whole, done fast.
  4. Scenario planning. Change a figure and see the predicted result.

Try it: change the view

Code: duckdb
select region, sum(amount) as total
from sales
group by region
order by region;

-- Try it: change region to product, then to month. One word gives a new report.

Worked example: slice, drill down and roll up

MoveWhat you doBakery example
SliceFix one dimension to one valueOnly the January rows
DiceFix several dimensions to chosen valuesJanuary and February, North only
Drill downGo from a total to its detailFrom all sales to sales in the North
Roll upGo from detail to a totalFrom each product to all products

The cells students fill in are left blank in this preview.

The lesson goes on

5 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.