pbPassingBI
/
Blending & structuring beginner 5 min

Union and Append Fields

Stacking rows and attaching fields — and the difference from a join.

What you'll be able to do
  • Stack datasets with Union
  • Handle mismatched fields
  • Use Append Fields deliberately

Union

Union stacks datasets vertically — twelve monthly files into one table.

The configuration that matters is how fields are matched:

  • Auto by name — safest; matches on field name whatever the order
  • Auto by position — matches column 1 to column 1; dangerous if column order differs
  • Manually configure — explicit mapping, for when names differ
By position is a silent hazard

If one file has its columns in a different order, matching by position puts city values into the region field with no error at all. Use by name unless you have a specific reason not to.

Mismatched fields

When one input has a field the others lack, Union outputs it with nulls for the inputs that did not have it. Set the tool to error or warn on that if the schemas ought to be identical — silence is not what you want when a source has changed shape.

Append Fields

Append Fields attaches every row of the source input to every row of the target — a Cartesian product.

10 target rows and 5 source rows gives 50. That is deliberate and useful for adding a single row of parameters (a rate, a report date) to every row of data.

It multiplies

Append Fields with more than one source row multiplies your data. It warns above a threshold, but the warning is easy to miss. If you meant to match rows to rows, you wanted Join.

Which to use

NeedTool
Stack similar datasetsUnion
Match rows by a keyJoin
Add one row of values to every rowAppend Fields
Key points
  • Union by name is safe; by position silently misaligns columns
  • Append Fields produces a Cartesian product — one source row, or it multiplies
  • Union stacks, Join matches, Append attaches to everything
Check yourself