Skip to content

Lesson 10 ยท Blending and Joining

Union, Join Multiple and Append Fields

Stack tables with the Alteryx Union tool, choose by-name or by-position mode, combine several inputs with Join Multiple and use Append Fields safely.

A join puts tables side by side. A union stacks them on top of each other. This lesson covers the Union tool, plus two related tools: Join Multiple for several inputs at once, and Append Fields for adding values to every row.

These tools are simple to configure and easy to get subtly wrong.

The Union tool

You can connect several streams to the single input anchor of a Union tool. It then combines them into one table. It has three configuration modes:

Mode How columns are matched Typical risk
Auto configure by name (default) By column names A renamed column becomes a separate column
Auto configure by position First with first, second with second Different order silently mixes columns
Manual configure You line them up yourself New or missing fields can cause errors later

When columns do not line up, you can choose how the tool reacts, for example with an error, a warning, or by keeping only some columns, and whether to output all fields or only the common ones. Exact option names vary by version. Choose the strict setting when a mismatch means something is wrong.

Union matching modes

By name Safe for reordered columns
By position Only if order is fixed
Manual Fragile if layouts change

Check null columns after every union

1 / 2

Why by-position can corrupt data

Python Stand-in: union by name versus by position

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The by-position result says February sold 8 and returned 90. Nothing failed and no warning appeared. This is why you must check outputs.

Renamed columns

With by-name matching, Sales and sales_amount become two columns, each half empty. Fix names before the union with a Select tool. A good habit is to check for unexpected nulls afterward:

SQL Stand-in: detect half-empty columns after a union

Press Run (or Ctrl + Enter) to see the result here.

Also check the data types. When two files give the same column different types, such as text and number, convert them first so that both match.

Row order after a union

The order of rows from different inputs may follow the order of the connections, but do not rely on it. If order matters, set the output order option or sort afterward. You may add a column that records the source file, so you can sort and audit by it.

Join Multiple

Join Multiple joins three or more inputs in one tool, using key fields or record position. By default it behaves like a full outer join, keeping records even if some inputs lack them. An option restricts the output to records found in all inputs.

The danger of row multiplication grows with each input. If three inputs each have two rows for a key, the result has eight rows for it. Verify that all inputs but one are unique on the key.

Append Fields

Append Fields adds every row of a source input to every row of a target input. This is a cross join. It has two inputs labeled T (targets) and S (source).

Common uses:

  • Add a single total to every row so that each row can compute its share.
  • Attach a parameter, such as an exchange rate or a run date.
  • Generate all combinations, such as every store with every month.
SQL Stand-in: append a total to compute each share

Press Run (or Ctrl + Enter) to see the result here.

Because it is a cross join, 1,000 target rows times 1,000 source rows make a million rows. Designer can warn or stop when the source is large. Keep the source as small as possible, ideally a single row.

A union checklist

Before you trust a union of many files, check the following:

  1. Same meaning. Two columns with the same name may use different units, for example euros in one file and thousands of euros in another. No tool can know this for you.
  2. Same grain. Do not stack daily rows with monthly totals.
  3. Source label. Add a column that names the file or system each row came from.
  4. Row count. The output should contain the sum of the input counts.
  5. Null profile. A column that is empty for exactly one source usually means a naming mismatch.

Run the checklist again when a source changes its export. A strict mismatch setting plus these checks will tell you early.

When to chain Join tools instead

Several Join tools in a row let you inspect unmatched rows at every step. Join Multiple is more compact when all inputs share one key and you do not need those side outputs. Prefer the chain while you are exploring new data.

Practice task

Create three monthly tables. In the second, reorder the columns. In the third, rename one column and store the amounts as text. Predict what union by name and union by position will produce.

Run both and describe each problem you find. Then repair the third table with a Select tool, add a source column to all three and union by name. Verify the row count and the total. As a final step, use Append Fields to add the grand total to each row, and check that the shares add up to 100 percent, apart from rounding.

Common mistakes

Never accept union-by-position on files from different people unless a test proves the column order is fixed.

  • Ignoring the warnings about mismatched fields.
  • Using Append Fields when you meant to Join on a key.
  • Forgetting that Join Multiple may keep unmatched rows with nulls.

Check your understanding

Quick check ยท 3 questions

of 3 answered You scored / 3 ยท perfect!

  1. 1. Which union mode matches columns using their names?

    By name aligns columns that share the same name.
  2. 2. Two files name a column Sales and sales_amount. What does union by name produce?

    Different names are different columns, so rename them first.
  3. 3. What kind of operation is Append Fields?

    Every source row is attached to every target row.

Summary

  • Union stacks tables by name, position or manual mapping.
  • By-position can silently mix up columns; by-name can create extra half-empty ones.
  • Join Multiple combines several inputs; watch for row multiplication.
  • Append Fields is a cross join, best with a tiny source.

Next: Find Replace and Fuzzy Match

Your progress is saved in this browser. No account needed.