Preppin' Data 2022 Week 40 - Running Before Walking

Everyone remembers filling out and memorizing the times table. Preppin' Data 2022 Week 40 was a simple challenge that brought back memories.

From an input of one column (Numbers) and two rows (values of 1 and 9), replicate a 9x9 multiplication grid in Tableau Prep.

Easy! Create new rows, pivot something, and join something. 30 minutes later, I have errors upon errors, two columns, and one row of data with the value 1.

I ran before I walked and didn't do the first step of any data prep – plan.

The Plan

Following Preppin' Data's How to… Plan your Prep, let's break this down into four stages.

Stage 1 – Know Your Data

  • Columns: 1
  • Rows: 2
  • Field Name: Numbers
  • Data Type: Number (whole)
  • Granularity: One row per number
  • Nulls: None

A seemingly harmless dataset. What could possibly go wrong?

Stage 2 – The Desired State

  • Columns: 10 (one identifying column and nine multiplication columns)
  • Rows: 9
  • Data Type: Number (whole)
  • Granularity: One row per number, containing its multiples from 1 to 9.

Although we only need nine rows in our final output, we'll need to generate 81 rows at some point in our workflow to account for every possible combination of numbers from 1 to 9.

Stage 3 – From Knowing Your Data to the Desired State

Without touching Tableau Prep, what actually needs to happen to my data?

  • Generate the missing numbers between 1 and 9.
  • Create every possible combination of those nine numbers, including combinations of the same number.
  • Multiply the two numbers in each combination.
  • Restructure the data so that the second set of numbers becomes column headers and their products populate the columns.
  • Clean up the remaining fields to match the desired output.

It is much easier to think about what needs to happen to the data when I'm not simultaneously trying to figure out which tools to use on Tableau Prep.

Stage 4 – Build It

1. Generate the missing rows

Using the New Rows step, I generated the missing values between 1 and 9, bringing my row count from 2 to 9.

2. Create every possible combination of numbers

This was the part that initially tripped me up. I needed every number to be paired with every other number, including itself.

I approached this by joining the dataset to itself twice, but with different join conditions.

The first join used an equals (=) condition. This returned nine rows, accounting for combinations such as 1 and 1, 2 and 2, and so on.

The second join used a not equals (!=) condition. This returned 72 rows, accounting for all the remaining combinations.

3. Union the two joins

Since the two joins produced the same fields but different rows, I unioned the results together.

9 + 72 = 81 rows!

We now have every possible combination needed to create our multiplication table.

4. Create a calculated field

I created a calculated field called Values to multiply the two numbers:

[Numbers] * [Numbers-1]

I also removed the Table Names field generated by the union since it was no longer needed.

5. Pivot rows to columns

Using a rows-to-columns pivot, I selected Numbers-1 as the field to pivot and Values as the field to aggregate.

I used AVG as my aggregation. Since each combination of numbers only occurs once, the average simply returns the product itself.

This brought my dataset from 81 rows and three columns to nine rows and ten columns.

6. Final touches

I used the Rank calculation in ascending order to generate the Number field and removed the original Numbers field to match the desired output.

I knew how to use the tools needed to solve this challenge. I knew how to generate rows, join, union, create calculated fields, and pivot. What I didn't know was how I wanted my data to change at each step.

Knowing how to use a tool and knowing when and why to use it are two very different skills.

Spend more time planning, less time aimlessly clicking around Tableau Prep!

Author:
Ianah Bantay
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2026 The Information Lab