UNION

UNION(set, set)

Combines two sets into one, holding every row that is in either, such as a task's predecessors and its successors together. A row in both appears once, so counting a union never counts a task twice, and both sets must hold the same kind of row.

Arguments

ArgumentWhat to give it
setA set of rows: Predecessors, FILTER(…), SAME([Phase]).
setA second set of the same kind of row: tasks with tasks, assignments with assignments.

Examples

Formula
=COUNT(UNION(Predecessors, Successors))

How many tasks the task is tied to directly, in either direction.

Formula
=COUNT(FILTER(UNION(Upstream, Downstream), UNION(Upstream, Downstream)[Critical]))

How many critical tasks share a logic path with this one, before or after it. A filter's condition must read the set it filters, so the union is written again (or named once with LET).

Formula on WBS rows
=COUNT(UNION(Children, Ancestors))

On a WBS row: the nodes directly below it and every node above it.

Reach for something else when

You wantUse
Only rows in both setsINTERSECT
Rows in one set but not the otherEXCEPT
Rows that meet any of several conditions, from one setFILTER with OR

Common questions

Why does the editor say "UNION needs two sets of the same kind"?

The two sets hold different rows, such as tasks and links. InLinks is a set of links, not tasks; use Predecessors for the tasks at the other end.

The editor refuses this
=COUNT(UNION(Predecessors, OutLinks))

In what order are the rows?

In schedule order, whichever set they came from, so FIRST of a union is the earliest of its rows in that order.